Re: need SUNRPC TCP to receive into aligned pages [was: Re: [PATCH 1/6] NFSD: add the ability to enable use of RWF_DONTCACHE for all IO]

NeilBrown
2025-07-03T00:12:10Z

On Thu, 12 Jun 2025, Jeff Layton wrote:
>
> I've been looking over the code today. Basically, I think we need to
> have svc_tcp_recvfrom() receive in phases. At a high level:
>
> 1/ receive the record marker (just like it does today)

Long ago (IETF 47??) I heard someone talking about a "smart" network
card that would detect UDP packets to port 2049, split the data into the
largest power-of-2 as a final component and the remainder as a header,
and DMA them into memory that way. This would very often put the data
in page-aligned memory.

We could do the same thing here.
Currently we copy as much as will fit into the "header" and the rest
into the "pages". We could instead use power-of-2 maths to put some in
the header and a whole number of pages into the "pages".

This would probably work well for NFSv3 and shouldn't make NFSv4 worse
It wouldn't provide a guarantee, but could provide a useful
optimisation.

NeilBrown