1. 31 May, 2023 3 commits
    • David Howells's avatar
      block: Use iov_iter_extract_pages() and page pinning in direct-io.c · 1ccf164e
      David Howells authored
      Change the old block-based direct-I/O code to use iov_iter_extract_pages()
      to pin user pages or leave kernel pages unpinned rather than taking refs
      when submitting bios.
      
      This makes use of the preceding patches to not take pins on the zero page
      (thereby allowing insertion of zero pages in with pinned pages) and to get
      additional pins on pages, allowing an extracted page to be used in multiple
      bios without having to re-extract it.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Christoph Hellwig <hch@infradead.org>
      cc: David Hildenbrand <david@redhat.com>
      cc: Lorenzo Stoakes <lstoakes@gmail.com>
      cc: Andrew Morton <akpm@linux-foundation.org>
      cc: Jens Axboe <axboe@kernel.dk>
      cc: Al Viro <viro@zeniv.linux.org.uk>
      cc: Matthew Wilcox <willy@infradead.org>
      cc: Jan Kara <jack@suse.cz>
      cc: Jeff Layton <jlayton@kernel.org>
      cc: Jason Gunthorpe <jgg@nvidia.com>
      cc: Logan Gunthorpe <logang@deltatee.com>
      cc: Hillf Danton <hdanton@sina.com>
      cc: Christian Brauner <brauner@kernel.org>
      cc: Linus Torvalds <torvalds@linux-foundation.org>
      cc: linux-fsdevel@vger.kernel.org
      cc: linux-block@vger.kernel.org
      cc: linux-kernel@vger.kernel.org
      cc: linux-mm@kvack.org
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Link: https://lore.kernel.org/r/20230526214142.958751-4-dhowells@redhat.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
      1ccf164e
    • David Howells's avatar
      mm: Provide a function to get an additional pin on a page · 1101fb8f
      David Howells authored
      Provide a function to get an additional pin on a page that we already have
      a pin on.  This will be used in fs/direct-io.c when dispatching multiple
      bios to a page we've extracted from a user-backed iter rather than redoing
      the extraction.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Christoph Hellwig <hch@infradead.org>
      cc: David Hildenbrand <david@redhat.com>
      cc: Lorenzo Stoakes <lstoakes@gmail.com>
      cc: Andrew Morton <akpm@linux-foundation.org>
      cc: Jens Axboe <axboe@kernel.dk>
      cc: Al Viro <viro@zeniv.linux.org.uk>
      cc: Matthew Wilcox <willy@infradead.org>
      cc: Jan Kara <jack@suse.cz>
      cc: Jeff Layton <jlayton@kernel.org>
      cc: Jason Gunthorpe <jgg@nvidia.com>
      cc: Logan Gunthorpe <logang@deltatee.com>
      cc: Hillf Danton <hdanton@sina.com>
      cc: Christian Brauner <brauner@kernel.org>
      cc: Linus Torvalds <torvalds@linux-foundation.org>
      cc: linux-fsdevel@vger.kernel.org
      cc: linux-block@vger.kernel.org
      cc: linux-kernel@vger.kernel.org
      cc: linux-mm@kvack.org
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Acked-by: default avatarDavid Hildenbrand <david@redhat.com>
      Link: https://lore.kernel.org/r/20230526214142.958751-3-dhowells@redhat.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
      1101fb8f
    • David Howells's avatar
      mm: Don't pin ZERO_PAGE in pin_user_pages() · c8070b78
      David Howells authored
      Make pin_user_pages*() leave a ZERO_PAGE unpinned if it extracts a pointer
      to it from the page tables and make unpin_user_page*() correspondingly
      ignore a ZERO_PAGE when unpinning.  We don't want to risk overrunning a
      zero page's refcount as we're only allowed ~2 million pins on it -
      something that userspace can conceivably trigger.
      
      Add a pair of functions to test whether a page or a folio is a ZERO_PAGE.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Christoph Hellwig <hch@infradead.org>
      cc: David Hildenbrand <david@redhat.com>
      cc: Lorenzo Stoakes <lstoakes@gmail.com>
      cc: Andrew Morton <akpm@linux-foundation.org>
      cc: Jens Axboe <axboe@kernel.dk>
      cc: Al Viro <viro@zeniv.linux.org.uk>
      cc: Matthew Wilcox <willy@infradead.org>
      cc: Jan Kara <jack@suse.cz>
      cc: Jeff Layton <jlayton@kernel.org>
      cc: Jason Gunthorpe <jgg@nvidia.com>
      cc: Logan Gunthorpe <logang@deltatee.com>
      cc: Hillf Danton <hdanton@sina.com>
      cc: Christian Brauner <brauner@kernel.org>
      cc: Linus Torvalds <torvalds@linux-foundation.org>
      cc: linux-fsdevel@vger.kernel.org
      cc: linux-block@vger.kernel.org
      cc: linux-kernel@vger.kernel.org
      cc: linux-mm@kvack.org
      Reviewed-by: default avatarLorenzo Stoakes <lstoakes@gmail.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Acked-by: default avatarDavid Hildenbrand <david@redhat.com>
      Link: https://lore.kernel.org/r/20230526214142.958751-2-dhowells@redhat.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
      c8070b78
  2. 30 May, 2023 4 commits
  3. 24 May, 2023 33 commits