]> git.ipfire.org Git - thirdparty/linux.git/commit
SUNRPC: Optimize rq_respages allocation in svc_alloc_arg
authorChuck Lever <chuck.lever@oracle.com>
Thu, 26 Feb 2026 14:47:39 +0000 (09:47 -0500)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 30 Mar 2026 01:25:09 +0000 (21:25 -0400)
commitd7f3efd9ff474867b04e1ea784690f02450a245b
tree9b7b29faf3aa65993f1642c6f06d42d72034bc8a
parent7ed7504287a627834f2a35ef04e5dfd26d1c8986
SUNRPC: Optimize rq_respages allocation in svc_alloc_arg

svc_alloc_arg() invokes alloc_pages_bulk() with the full rq_maxpages
count (~259 for 1MB messages) for the rq_respages array, causing a
full-array scan despite most slots holding valid pages.

svc_rqst_release_pages() NULLs only the range

  [rq_respages, rq_next_page)

after each RPC, so only that range contains NULL entries. Limit the
rq_respages fill in svc_alloc_arg() to that range instead of
scanning the full array.

svc_init_buffer() initializes rq_next_page to span the entire
rq_respages array, so the first svc_alloc_arg() call fills all
slots.

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
include/linux/sunrpc/svc.h
net/sunrpc/svc.c
net/sunrpc/svc_xprt.c