Re: [PATCH v4 05/14] sunrpc: Replace the rq_vec array with dynamically-allocated memory

Christoph Hellwig
2025-05-06T13:29:21Z

On Mon, Apr 28, 2025 at 03:36:53PM -0400, cel@kernel.org wrote:
> From: Chuck Lever <chuck.lever@oracle.com>
>
> As a step towards making NFSD's maximum rsize and wsize variable at
> run-time, replace the fixed-size rq_vec[] array in struct svc_rqst
> with a chunk of dynamically-allocated memory.
>
> The rq_vec array is sized assuming request processing will need at
> most one kvec per page in a maximum-sized RPC message.
>
> On a system with 8-byte pointers and 4KB pages, pahole reports that
> the rq_vec[] array is 4144 bytes. This patch replaces that array
> with a single 8-byte pointer field.

The right thing to do here is to kill this array. There is no
reason to use kvecs in the VFS read/write APIs these days, we can
use bio_vecs just fine, for which we have another allocation.

Instead this should use the same bio_vec array as the svcsock code.

And given that both are only used by the server and never the client
maybe they should both only be conditionally allocated?