All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chuck Lever <cel@kernel.org>
To: linux-nfs@vger.kernel.org, linux-mm@kvack.org
Subject: [PATCH v1 3/4] SUNRPC: Convert svc_tcp_restore_pages() to the release_pages() API
Date: Fri, 14 Apr 2023 20:18:09 -0400	[thread overview]
Message-ID: <168151788914.1588.17896994938586012232.stgit@klimt.1015granger.net> (raw)
In-Reply-To: <168151777579.1588.7882383278745556830.stgit@klimt.1015granger.net>

From: Chuck Lever <chuck.lever@oracle.com>

Instead of invoking put_page() one-at-a-time, pass the portion of
rq_pages to be released directly to release_pages() to reduce the
number of times each server thread invokes a page allocator API.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 net/sunrpc/svcsock.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 302a14dd7882..44f72b558a1c 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -812,12 +812,12 @@ static size_t svc_tcp_restore_pages(struct svc_sock *svsk,
 	if (!len)
 		return 0;
 	npages = (len + PAGE_SIZE - 1) >> PAGE_SHIFT;
-	for (i = 0; i < npages; i++) {
-		if (rqstp->rq_pages[i] != NULL)
-			put_page(rqstp->rq_pages[i]);
-		BUG_ON(svsk->sk_pages[i] == NULL);
-		rqstp->rq_pages[i] = svsk->sk_pages[i];
-		svsk->sk_pages[i] = NULL;
+	if (npages) {
+		release_pages(rqstp->rq_pages, npages);
+		for (i = 0; i < npages; i++) {
+			rqstp->rq_pages[i] = svsk->sk_pages[i];
+			svsk->sk_pages[i] = NULL;
+		}
 	}
 	rqstp->rq_arg.head[0].iov_base = page_address(rqstp->rq_pages[0]);
 	return len;



  parent reply	other threads:[~2023-04-15  0:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-15  0:17 [PATCH v1 0/4] NFSD memory allocation optimizations Chuck Lever
2023-04-15  0:17 ` [PATCH v1 1/4] SUNRPC: Relocate svc_free_res_pages() Chuck Lever
2023-04-15  0:18 ` [PATCH v1 2/4] SUNRPC: Convert svc_xprt_release() to the release_pages() API Chuck Lever
2023-04-15  0:18 ` Chuck Lever [this message]
2023-04-15  0:18 ` [PATCH v1 4/4] SUNRPC: Be even lazier about releasing pages Chuck Lever
2023-04-15 17:24 ` [PATCH v1 0/4] NFSD memory allocation optimizations Calum Mackay

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=168151788914.1588.17896994938586012232.stgit@klimt.1015granger.net \
    --to=cel@kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-nfs@vger.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 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.