On 4/22/25 4:48 PM, NeilBrown wrote: > On Sun, 20 Apr 2025, cel@xxxxxxxxxx wrote: >> From: Chuck Lever <chuck.lever@xxxxxxxxxx> >> >> 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@xxxxxxxxxx> >> --- >> 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