linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Chuck Lever <chuck.lever@oracle.com>
To: linux-nfs@vger.kernel.org, linux-mm@kvack.org
Cc: neilb@suse.de
Subject: [PATCH v3 3/3] NFSD: Batch release pages during splice read
Date: Thu, 08 Jul 2021 11:26:35 -0400	[thread overview]
Message-ID: <162575799527.2532.9850430992854215546.stgit@klimt.1015granger.net> (raw)
In-Reply-To: <162575623717.2532.8517369487503961860.stgit@klimt.1015granger.net>

Large splice reads call put_page() repeatedly. put_page() is
relatively expensive to call, so replace it with the new
svc_rqst_replace_page() helper to help amortize that cost.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/vfs.c |    9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index da5340dc0203..43ac23b200d2 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -849,15 +849,10 @@ nfsd_splice_actor(struct pipe_inode_info *pipe, struct pipe_buffer *buf,
 	struct page *page = buf->page;
 
 	if (rqstp->rq_res.page_len == 0) {
-		get_page(page);
-		put_page(*rqstp->rq_next_page);
-		*(rqstp->rq_next_page++) = page;
+		svc_rqst_replace_page(rqstp, page);
 		rqstp->rq_res.page_base = buf->offset;
 	} else if (page != pp[-1]) {
-		get_page(page);
-		if (*rqstp->rq_next_page)
-			put_page(*rqstp->rq_next_page);
-		*(rqstp->rq_next_page++) = page;
+		svc_rqst_replace_page(rqstp, page);
 	}
 	rqstp->rq_res.page_len += sd->len;
 




  parent reply	other threads:[~2021-07-08 16:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-08 15:26 [PATCH v3 0/3] Bulk-release pages during NFSD read splice Chuck Lever
2021-07-08 15:26 ` [PATCH v3 1/3] NFSD: Clean up splice actor Chuck Lever
2021-07-08 15:26 ` [PATCH v3 2/3] SUNRPC: Add svc_rqst_replace_page() API Chuck Lever
2021-07-08 23:30   ` Matthew Wilcox
2021-07-09  3:04     ` Chuck Lever III
2021-07-08 15:26 ` Chuck Lever [this message]
2021-07-08 23:23 ` [PATCH v3 0/3] Bulk-release pages during NFSD read splice NeilBrown
2021-07-09  2:58   ` Chuck Lever III

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=162575799527.2532.9850430992854215546.stgit@klimt.1015granger.net \
    --to=chuck.lever@oracle.com \
    --cc=linux-mm@kvack.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neilb@suse.de \
    /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