Linux NFS development
 help / color / mirror / Atom feed
From: Pranjal Shrivastava <praan@google.com>
To: Anna Schumaker <anna@kernel.org>
Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	Trond Myklebust <trondmy@kernel.org>,
	Christoph Hellwig <hch@lst.de>,
	Christoph Hellwig <hch@infradead.org>,
	Shivaji Kant <shivajikant@google.com>
Subject: Re: [PATCH v1 1/7] nfs: make nfs_page pin-aware
Date: Thu, 4 Jun 2026 07:51:39 +0000	[thread overview]
Message-ID: <aiEui-aLhGUAa0MR@google.com> (raw)
In-Reply-To: <9cd182d7-8f31-499d-aeec-33bf86271fa6@app.fastmail.com>

On Wed, Jun 03, 2026 at 12:39:47PM -0400, Anna Schumaker wrote:
> Hi Pranjal,
> 
> On Wed, Jun 3, 2026, at 1:30 AM, Pranjal Shrivastava wrote:
> > Modernizing the NFS Direct I/O path to use iov_iter_extract_pages()
> > introduces page pinning (GUP) instead of standard page referencing.
> > To handle this correctly, nfs_page must track whether it holds a
> > pin or a standard reference.
> >
> > Introduce a new flag, PG_PINNED, to struct nfs_page. Update the creation
> > path (nfs_page_create_from_page and nfs_page_create_from_folio) to
> > accept a pinned bool and set the flag accordingly. If the page is pinned,
> > we skip the existing reference increment (get_page/folio_get) as the pin
> > itself acts as a reference.
> >
> > Update nfs_clear_request() & nfs_direct_release_pages() to use
> > unpin_user_page() or unpin_user_folio() instead of only refcount
> > decrement (put_page) when PG_PINNED flag is set. Finally, ensure
> > subrequests inherit the pinning status from their parent request.
> >
> > Signed-off-by: Pranjal Shrivastava <praan@google.com>
> > ---
> >  fs/nfs/direct.c          | 22 +++++++++++++++-------
> >  fs/nfs/pagelist.c        | 36 ++++++++++++++++++++++++++----------
> >  fs/nfs/read.c            |  2 +-
> >  fs/nfs/write.c           |  2 +-
> >  include/linux/nfs_page.h |  3 +++
> >  5 files changed, 46 insertions(+), 19 deletions(-)
> >
> > diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
> > index 48d89716193a..80319c5eeed4 100644
> > --- a/fs/nfs/direct.c
> > +++ b/fs/nfs/direct.c

Hi Anna,

[...]

> > 
> > @@ -435,6 +441,7 @@ static void nfs_page_assign_page(struct nfs_page 
> > *req, struct page *page)
> >   */
> >  struct nfs_page *nfs_page_create_from_page(struct nfs_open_context 
> > *ctx,
> >  					   struct page *page,
> > +					   bool pinned,
> 
> Can you add a description for "pinned" to the kernel doc comment right
> above this function? I'm seeing:
> 
> Warning: fs/nfs/pagelist.c:446 function parameter 'pinned' not described in 'nfs_page_create_from_page'

Ack. I'll add a description in v2.

> 
> 
> >  					   unsigned int pgbase, loff_t offset,
> >  					   unsigned int count)
> >  {
> > @@ -446,7 +453,7 @@ struct nfs_page *nfs_page_create_from_page(struct 
> > nfs_open_context *ctx,
> >  	ret = nfs_page_create(l_ctx, pgbase, offset >> PAGE_SHIFT,
> >  			      offset_in_page(offset), count);
> >  	if (!IS_ERR(ret)) {
> > -		nfs_page_assign_page(ret, page);
> > +		nfs_page_assign_page(ret, page, pinned);
> >  		nfs_page_group_init(ret, NULL);
> >  	}
> >  	nfs_put_lock_context(l_ctx);
> > @@ -466,6 +473,7 @@ struct nfs_page *nfs_page_create_from_page(struct 
> > nfs_open_context *ctx,
> >   */
> >  struct nfs_page *nfs_page_create_from_folio(struct nfs_open_context 
> > *ctx,
> >  					    struct folio *folio,
> > +					    bool pinned,
> 
> Same here:
> 
> Warning: fs/nfs/pagelist.c:478 function parameter 'pinned' not described in 'nfs_page_create_from_folio'

Ack. I'll add a description in v2.

[...]

Thanks,
Praan

  reply	other threads:[~2026-06-04  7:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-03  5:30 [PATCH v1 0/7] nfs: Modernize Direct I/O path Pranjal Shrivastava
2026-06-03  5:30 ` [PATCH v1 1/7] nfs: make nfs_page pin-aware Pranjal Shrivastava
2026-06-03 16:39   ` Anna Schumaker
2026-06-04  7:51     ` Pranjal Shrivastava [this message]
2026-06-03  5:30 ` [PATCH v1 2/7] nfs: Track number of pinned pages in nfs_page Pranjal Shrivastava
2026-06-03  5:30 ` [PATCH v1 3/7] nfs: Introduce nfs_release_request_list helper Pranjal Shrivastava
2026-06-03  5:30 ` [PATCH v1 4/7] nfs: migrate direct I/O to iov_iter_extract_pages Pranjal Shrivastava
2026-06-03  5:30 ` [PATCH v1 5/7] nfs: introduce nfs_direct_extract_pages helper Pranjal Shrivastava
2026-06-03  5:30 ` [PATCH v1 6/7] nfs: Optimize direct I/O to use folios for requests Pranjal Shrivastava
2026-06-03 19:14   ` Anna Schumaker
2026-06-04  7:59     ` Pranjal Shrivastava
2026-06-03  5:30 ` [PATCH v1 7/7] nfs: Cleanup the nfs_page_create_from_page helper Pranjal Shrivastava
2026-06-03  5:33 ` [PATCH v1 0/7] nfs: Modernize Direct I/O path 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=aiEui-aLhGUAa0MR@google.com \
    --to=praan@google.com \
    --cc=anna@kernel.org \
    --cc=hch@infradead.org \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=shivajikant@google.com \
    --cc=trondmy@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox