public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Chuck Lever <cel@kernel.org>, NeilBrown <neilb@ownmail.net>,
	Olga Kornievskaia <okorniev@redhat.com>,
	Dai Ngo <dai.ngo@oracle.com>, Tom Talpey <tom@talpey.com>
Cc: linux-nfs@vger.kernel.org, Chuck Lever <chuck.lever@oracle.com>
Subject: Re: [PATCH v2 3/6] SUNRPC: Handle NULL entries in svc_rqst_release_pages
Date: Tue, 10 Mar 2026 14:11:56 -0400	[thread overview]
Message-ID: <650d2575fafc198b8bc68e91ebe052d064651818.camel@kernel.org> (raw)
In-Reply-To: <20260226144739.193129-4-cel@kernel.org>

On Thu, 2026-02-26 at 09:47 -0500, Chuck Lever wrote:
> From: Chuck Lever <chuck.lever@oracle.com>
> 
> svc_rqst_release_pages() releases response pages between rq_respages
> and rq_next_page. It currently passes the entire range to
> release_pages(), which does not expect NULL entries.
> 
> A subsequent patch preserves the rq_next_page pointer in
> svc_rdma_save_io_pages() so that it accurately records how many
> response pages were consumed. After that change, the range
> 
>   [rq_respages, rq_next_page)
> 
> can contain NULL entries where pages have already been transferred
> to a send context.
> 
> Iterate through the range entry by entry, skipping NULLs, to handle
> this case correctly.
> 
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
>  net/sunrpc/svc.c | 20 +++++++++++++-------
>  1 file changed, 13 insertions(+), 7 deletions(-)
> 
> diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
> index 9abef638b1e0..0ce16e9abdf6 100644
> --- a/net/sunrpc/svc.c
> +++ b/net/sunrpc/svc.c
> @@ -990,18 +990,24 @@ EXPORT_SYMBOL_GPL(svc_rqst_replace_page);
>   * svc_rqst_release_pages - Release Reply buffer pages
>   * @rqstp: RPC transaction context
>   *
> - * Release response pages that might still be in flight after
> - * svc_send, and any spliced filesystem-owned pages.
> + * Release response pages in the range [rq_respages, rq_next_page).
> + * NULL entries in this range are skipped, allowing transports to
> + * transfer pages to a send context before this function runs.
>   */
>  void svc_rqst_release_pages(struct svc_rqst *rqstp)
>  {
> -	int i, count = rqstp->rq_next_page - rqstp->rq_respages;
> +	struct page **pp;
>  
> -	if (count) {
> -		release_pages(rqstp->rq_respages, count);
> -		for (i = 0; i < count; i++)
> -			rqstp->rq_respages[i] = NULL;
> +	for (pp = rqstp->rq_respages; pp < rqstp->rq_next_page; pp++) {
> +		if (*pp) {
> +			if (!folio_batch_add(&rqstp->rq_fbatch,
> +					     page_folio(*pp)))
> +				__folio_batch_release(&rqstp->rq_fbatch);
> +			*pp = NULL;
> +		}
>  	}
> +	if (rqstp->rq_fbatch.nr)
> +		__folio_batch_release(&rqstp->rq_fbatch);
>  }
>  
>  /**

Reviewed-by: Jeff Layton <jlayton@kernel.org>

  reply	other threads:[~2026-03-10 18:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-26 14:47 [PATCH v2 0/6] Optimize NFSD buffer page management Chuck Lever
2026-02-26 14:47 ` [PATCH v2 1/6] SUNRPC: Tighten bounds checking in svc_rqst_replace_page Chuck Lever
2026-03-10 18:01   ` Jeff Layton
2026-02-26 14:47 ` [PATCH v2 2/6] SUNRPC: Allocate a separate Reply page array Chuck Lever
2026-03-10 18:10   ` Jeff Layton
2026-02-26 14:47 ` [PATCH v2 3/6] SUNRPC: Handle NULL entries in svc_rqst_release_pages Chuck Lever
2026-03-10 18:11   ` Jeff Layton [this message]
2026-02-26 14:47 ` [PATCH v2 4/6] svcrdma: preserve rq_next_page in svc_rdma_save_io_pages Chuck Lever
2026-03-10 18:13   ` Jeff Layton
2026-02-26 14:47 ` [PATCH v2 5/6] SUNRPC: Track consumed rq_pages entries Chuck Lever
2026-03-10 18:16   ` Jeff Layton
2026-02-26 14:47 ` [PATCH v2 6/6] SUNRPC: Optimize rq_respages allocation in svc_alloc_arg Chuck Lever
2026-03-10 18:18   ` Jeff Layton
2026-03-10 18:19 ` [PATCH v2 0/6] Optimize NFSD buffer page management Jeff Layton
2026-03-10 18:24   ` Chuck Lever

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=650d2575fafc198b8bc68e91ebe052d064651818.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=cel@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=dai.ngo@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neilb@ownmail.net \
    --cc=okorniev@redhat.com \
    --cc=tom@talpey.com \
    /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