On Sat, Aug 09, 2025 at 01:02:50AM -0400, Mike Snitzer wrote: > Hi, > > Some workloads benefit from NFSD avoiding the page cache, particularly > those with a working set that is significantly larger than available > system memory. This patchset introduces _optional_ support to > configure the use of O_DIRECT or DONTCACHE for NFSD's READ and WRITE > support. The NFSD default to use page cache is left unchanged. > > The performance win associated with using NFSD DIRECT was previously > summarized here: > https://lore.kernel.org/linux-nfs/aEslwqa9iMeZjjlV@xxxxxxxxxx/ > This picture offers a nice summary of performance gains: > https://original.art/NFSD_direct_vs_buffered_IO.jpg > > This series builds on what has been staged in the nfsd-testing branch. > > This code has proven to work well during my testing. Any suggestions > for further refinement are welcome. > > Thanks, > Mike > > Changes since v5: > - #define NFSD_READ_DIO_MIN_KB (32 << 10) > - switch to using pre-increment from post-increment. > - always get DIO alignment when opening regular nfsd_file (dropped > patch that only did if NFSD_IO_DIRECT). > - fixed nfsd_io_cache_{read,write}_set to not set NFSD_IO_UNSPECIFIED > if returning -EINVAL due to unrecognized value. > - use a switch statement in nfsd_iter_read like nfsd_iter_write > - Optimize nfsd_iter_read for default being buffered IO, like was done > for nfsd_iter_write in v5. FYI, I've found that in general we _do_ need to verify DIO-alignment more comprehensively. Which means I've needed to reinstate the use of a modified iov_iter_is_aligned. Otherwise the piece-wise checking that Keith suggested, by adding checks to existing loops and such, results in the underlying filesystem (XFS) returning -EINVAL due to alignment issues. So I'm now focusing on correctness and will hopefully be posting v7 of this patchset by the end of the week. Mike