From: Pranjal Shrivastava <praan@google.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Christoph Hellwig <hch@infradead.org>,
Trond Myklebust <trondmy@kernel.org>,
linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org,
Anna Schumaker <anna@kernel.org>,
Shivaji Kant <shivajikant@google.com>,
linux-mm@kvack.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v2 6/7] nfs: Optimize direct I/O to use folios for requests
Date: Fri, 19 Jun 2026 12:32:04 +0000 [thread overview]
Message-ID: <ajU2xJ1BAqqtog8T@google.com> (raw)
In-Reply-To: <ajQ21kH1ZVajS2Y7@casper.infradead.org>
On Thu, Jun 18, 2026 at 07:20:06PM +0100, Matthew Wilcox wrote:
Hi Matthew, Christoph, Trond,
> On Thu, Jun 18, 2026 at 07:10:45AM -0700, Christoph Hellwig wrote:
> > On Tue, Jun 16, 2026 at 05:23:48PM +0000, Pranjal Shrivastava wrote:
> > > AFAIU, the MM subsystem explicitly ensures that every valid struct page
> > > is part of a folio.
> >
> > It is definitively not what the vision for the folio is, although if
> > I'm not mistaken it actually is still true right now.
>
> It's not true, eg, for slab. While there's still a struct page there
> for slab, there's no refcount and flags like PG_locked have different
> meanings. You'll get into a lot of trouble trying to treat slabs as
> folios (and that will include assertions tripping).
>
> > This whole
> > area is a minefield unfortunately, and we also ran into it with
> > iov_iter_extract_bvecs and the earlier block code it was extracted
> > from. Adding the relevant people and lists, but for now your best
> > bet is to stick to what the block code does or even better reuse
> > as much as possible of that code.
>
> Yes. Fundamentally, it is no business of the filesystem what the iov_iter
> refers to. We can do direct io to slab memory, vmalloc memory, memory
> that doesn't have a struct page (eg iomem), or whatever we choose.
>
Thanks for the clarification. I understand the larger vision of keeping
filesystems agnostic to the underlying memory represented by the iov_iter
The documentation for page_folio() [1] mentions that "Every page is part
of a folio," but it appears there are important nuances regarding slab
and other memory types that I was not aware of.
However, I am a bit confused on one point:
Looking at iov_iter_extract_bvecs() [1] it relies on
get_contig_folio_len() [2], which calls page_folio() on the pages
extracted (via iov_iter_extract_pages()) without additional checks for
slab or vmalloc memory.
I am happy to refactor the NFS Direct I/O path to reuse the same helper
(get_contig_folio_len()) from the bvec extractor, but I'm a little
confused as the bvec extractor seems to suffer from the same risk?
Is the recommendation to keep these details abstracted by the iov_iter
lib and eventually hide things like iov_iter_extract_pages() and manual
folio conversions from filesystems entirely?
If that's the case, would it help to export get_contig_folio_len() (or
introduce new helpers) in the iov_iter lib for NFS and other fs to use?
Thanks,
Praan
[1] https://elixir.bootlin.com/linux/v7.1-rc6/source/include/linux/page-flags.h#L291
[2] https://elixir.bootlin.com/linux/v7.1/source/lib/iov_iter.c#L1849
next prev parent reply other threads:[~2026-06-19 12:32 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-16 13:39 [PATCH v2 0/7] nfs: Modernize Direct I/O path Pranjal Shrivastava
2026-06-16 13:39 ` [PATCH v2 1/7] nfs: make nfs_page pin-aware Pranjal Shrivastava
2026-06-16 13:39 ` [PATCH v2 2/7] nfs: Track number of pinned pages in nfs_page Pranjal Shrivastava
2026-06-16 13:39 ` [PATCH v2 3/7] nfs: Introduce nfs_release_request_list helper Pranjal Shrivastava
2026-06-16 13:39 ` [PATCH v2 4/7] nfs: migrate direct I/O to iov_iter_extract_pages Pranjal Shrivastava
2026-06-16 13:39 ` [PATCH v2 5/7] nfs: introduce nfs_direct_extract_pages helper Pranjal Shrivastava
2026-06-16 13:39 ` [PATCH v2 6/7] nfs: Optimize direct I/O to use folios for requests Pranjal Shrivastava
2026-06-16 15:29 ` Trond Myklebust
2026-06-16 17:23 ` Pranjal Shrivastava
2026-06-18 14:10 ` Christoph Hellwig
2026-06-18 18:20 ` Matthew Wilcox
2026-06-19 12:32 ` Pranjal Shrivastava [this message]
2026-06-16 13:40 ` [PATCH v2 7/7] nfs: Cleanup the nfs_page_create_from_page helper Pranjal Shrivastava
2026-06-16 14:15 ` [PATCH v2 0/7] nfs: Modernize Direct I/O path Pranjal Shrivastava
2026-06-18 13:46 ` Chuck Lever
2026-06-19 11:50 ` Pranjal Shrivastava
2026-06-18 14:11 ` Christoph Hellwig
2026-06-19 11:48 ` Pranjal Shrivastava
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ajU2xJ1BAqqtog8T@google.com \
--to=praan@google.com \
--cc=anna@kernel.org \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-nfs@vger.kernel.org \
--cc=shivajikant@google.com \
--cc=trondmy@kernel.org \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.