From: Chuck Lever <cel@kernel.org>
To: NeilBrown <neil@brown.name>
Cc: Jeff Layton <jlayton@kernel.org>,
Olga Kornievskaia <okorniev@redhat.com>,
Dai Ngo <dai.ngo@oracle.com>, Tom Talpey <tom@talpey.com>,
linux-nfs@vger.kernel.org, Chuck Lever <chuck.lever@oracle.com>
Subject: Re: [PATCH v2 02/10] sunrpc: Add a helper to derive maxpages from sv_max_mesg
Date: Wed, 23 Apr 2025 09:16:19 -0400 [thread overview]
Message-ID: <26a95e24-edc0-4a66-a54f-1a116cdea976@kernel.org> (raw)
In-Reply-To: <174535491846.500591.11542398392986089529@noble.neil.brown.name>
On 4/22/25 4:48 PM, NeilBrown wrote:
> On Sun, 20 Apr 2025, cel@kernel.org wrote:
>> From: Chuck Lever <chuck.lever@oracle.com>
>>
>> This page count is to be used to allocate various arrays of pages,
>> bio_vecs, and kvecs, replacing the fixed RPCSVC_MAXPAGES value.
>>
>> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
>> ---
>> include/linux/sunrpc/svc.h | 12 ++++++++++++
>> 1 file changed, 12 insertions(+)
>>
>> diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
>> index 74658cca0f38..5b879c31d7b8 100644
>> --- a/include/linux/sunrpc/svc.h
>> +++ b/include/linux/sunrpc/svc.h
>> @@ -159,6 +159,18 @@ extern u32 svc_max_payload(const struct svc_rqst *rqstp);
>> #define RPCSVC_MAXPAGES ((RPCSVC_MAXPAYLOAD+PAGE_SIZE-1)/PAGE_SIZE \
>> + 2 + 1)
>>
>> +/**
>> + * svc_serv_maxpages - maximum pages/kvecs needed for one RPC message
>> + * @serv: RPC service context
>> + *
>> + * Returns a count of pages or vectors that can hold the maximum
>> + * size RPC message for @serv.
>> + */
>> +static inline unsigned long svc_serv_maxpages(const struct svc_serv *serv)
>> +{
>> + return ((serv->sv_max_mesg + PAGE_SIZE - 1) >> PAGE_SHIFT) + 2 + 1;
>> +}
>> +
>
> This looks like it should be
> DIV_ROUND_UP(serv->sv_max_mesg, PAGE_SIZE) + 2
Fair enough! I had forgotten about that macro.
> Could we document what the "+ 2" is for??
10/10 in this series moves an existing documenting comment for that
purpose. I've relocated that hunk to this patch, but I think the text
needs to be revisited because it ignores NFSv4 COMPOUNDs that may
carry multiple payloads.
I plan to post a v3 of this series soon.
> Thanks,
> NeilBrown
>
>
>> /*
>> * The context of a single thread, including the request currently being
>> * processed.
>> --
>> 2.49.0
>>
>>
>
--
Chuck Lever
next prev parent reply other threads:[~2025-04-23 13:16 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-19 17:28 [PATCH v2 00/10] Allocate payload arrays dynamically cel
2025-04-19 17:28 ` [PATCH v2 01/10] sunrpc: Remove backchannel check in svc_init_buffer() cel
2025-04-21 12:16 ` Jeff Layton
2025-04-21 14:59 ` Chuck Lever
2025-04-19 17:28 ` [PATCH v2 02/10] sunrpc: Add a helper to derive maxpages from sv_max_mesg cel
2025-04-22 20:48 ` NeilBrown
2025-04-23 13:16 ` Chuck Lever [this message]
2025-04-19 17:28 ` [PATCH v2 03/10] sunrpc: Replace the rq_pages array with dynamically-allocated memory cel
2025-04-21 12:19 ` Jeff Layton
2025-04-19 17:28 ` [PATCH v2 04/10] sunrpc: Replace the rq_vec " cel
2025-04-21 12:22 ` Jeff Layton
2025-04-21 15:05 ` Chuck Lever
2025-04-19 17:28 ` [PATCH v2 05/10] sunrpc: Replace the rq_bvec " cel
2025-04-19 17:28 ` [PATCH v2 06/10] sunrpc: Adjust size of socket's receive page array dynamically cel
2025-04-19 17:28 ` [PATCH v2 07/10] svcrdma: Adjust the number of RDMA contexts per transport cel
2025-04-19 17:28 ` [PATCH v2 08/10] svcrdma: Adjust the number of entries in svc_rdma_recv_ctxt::rc_pages cel
2025-04-19 17:28 ` [PATCH v2 09/10] svcrdma: Adjust the number of entries in svc_rdma_send_ctxt::sc_pages cel
2025-04-19 17:28 ` [PATCH v2 10/10] sunrpc: Remove the RPCSVC_MAXPAGES macro cel
2025-04-19 17:54 ` [PATCH v2 00/10] Allocate payload arrays dynamically Chuck Lever
2025-04-21 12:28 ` Jeff Layton
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=26a95e24-edc0-4a66-a54f-1a116cdea976@kernel.org \
--to=cel@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=dai.ngo@oracle.com \
--cc=jlayton@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neil@brown.name \
--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