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

Chuck Lever
2025-05-06T16:31:39Z

On 5/6/25 9:29 AM, Christoph Hellwig wrote:
> 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.

Fair enough. That's a little more churn than I wanted to do in this
patch series, but maybe it's easier than I expect.

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

Not sure I follow you here. The client certainly does make extensive use
of xdr_buf::bvec.

--
Chuck Lever