]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
NFSD: Implement NFSD_IO_DIRECT for NFS READ
authorChuck Lever <chuck.lever@oracle.com>
Wed, 8 Oct 2025 13:52:30 +0000 (09:52 -0400)
committerChuck Lever <chuck.lever@oracle.com>
Sun, 16 Nov 2025 23:20:11 +0000 (18:20 -0500)
commitd686e64e931c594af8b27597f6bf04944c857ed7
treefca698dcfb42f174358aa3efd4b674301bd60018
parentd7de37d6d7ccfac9321d8cc4f36fc85dfadad54a
NFSD: Implement NFSD_IO_DIRECT for NFS READ

Add an experimental option that forces NFS READ operations to use
direct I/O instead of reading through the NFS server's page cache.

There is already at least one other layer of read caching: the page
cache on NFS clients.

The server's page cache, in many cases, is unlikely to provide
additional benefit. Some benchmarks have demonstrated that the
server's page cache is actively detrimental for workloads whose
working set is larger than the server's available physical memory.

For instance, on small NFS servers, cached NFS file content can
squeeze out local memory consumers. For large sequential workloads,
an enormous amount of data flows into and out of the page cache
and is consumed by NFS clients exactly once -- caching that data
is expensive to do and totally valueless.

For now this is a hidden option that can be enabled on test
systems for benchmarking. In the longer term, this option might
be enabled persistently or per-export. When the exported file
system does not support direct I/O, NFSD falls back to using
either DONTCACHE or buffered I/O to fulfill NFS READ requests.

Suggested-by: Mike Snitzer <snitzer@kernel.org>
Reviewed-by: Mike Snitzer <snitzer@kernel.org>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: NeilBrown <neil@brown.name>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/debugfs.c
fs/nfsd/nfsd.h
fs/nfsd/trace.h
fs/nfsd/vfs.c