kernel_samsung_a53x/fs/nfsd
Chuck Lever 810f34ab39 NFSD: Optimize DRC bucket pruning
[ Upstream commit 8847ecc9274a14114385d1cb4030326baa0766eb ]

DRC bucket pruning is done by nfsd_cache_lookup(), which is part of
every NFSv2 and NFSv3 dispatch (ie, it's done while the client is
waiting).

I added a trace_printk() in prune_bucket() to see just how long
it takes to prune. Here are two ends of the spectrum:

 prune_bucket: Scanned 1 and freed 0 in 90 ns, 62 entries remaining
 prune_bucket: Scanned 2 and freed 1 in 716 ns, 63 entries remaining
...
 prune_bucket: Scanned 75 and freed 74 in 34149 ns, 1 entries remaining

Pruning latency is noticeable on fast transports with fast storage.
By noticeable, I mean that the latency measured here in the worst
case is the same order of magnitude as the round trip time for
cached server operations.

We could do something like moving expired entries to an expired list
and then free them later instead of freeing them right in
prune_bucket(). But simply limiting the number of entries that can
be pruned by a lookup is simple and retains more entries in the
cache, making the DRC somewhat more effective.

Comparison with a 70/30 fio 8KB 12 thread direct I/O test:

Before:

  write: IOPS=61.6k, BW=481MiB/s (505MB/s)(14.1GiB/30001msec); 0 zone resets

WRITE:
	1848726 ops (30%)
	avg bytes sent per op: 8340 avg bytes received per op: 136
	backlog wait: 0.635158 	RTT: 0.128525 	total execute time: 0.827242 (milliseconds)

After:

  write: IOPS=63.0k, BW=492MiB/s (516MB/s)(14.4GiB/30001msec); 0 zone resets

WRITE:
	1891144 ops (30%)
	avg bytes sent per op: 8340 avg bytes received per op: 136
	backlog wait: 0.616114 	RTT: 0.126842 	total execute time: 0.805348 (milliseconds)

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:47 +01:00
..
acl.h
auth.c
auth.h
blocklayout.c
blocklayoutxdr.c
blocklayoutxdr.h
cache.h
current_stateid.h
export.c nfsd: report per-export stats 2024-11-19 12:27:31 +01:00
export.h nfsd: report per-export stats 2024-11-19 12:27:31 +01:00
fault_inject.c
filecache.c fsnotify: Protect fsnotify_handle_inode_event from no-inode events 2024-11-19 12:27:46 +01:00
filecache.h
flexfilelayout.c
flexfilelayoutxdr.c
flexfilelayoutxdr.h
idmap.h
Kconfig NFSv4.2: Remove ifdef CONFIG_NFSD from NFSv4.2 client SSC code. 2024-11-19 12:27:37 +01:00
lockd.c Keep read and write fds with each nlm_file 2024-11-19 12:27:44 +01:00
Makefile
netns.h NFSD: delay unmount source's export after inter-server copy completed. 2024-11-19 12:27:39 +01:00
nfs2acl.c NFSD: Update the NFSv2 ACL ACCESS result encoder to use struct xdr_stream 2024-11-19 12:27:35 +01:00
nfs3acl.c nfsd: fix NULL dereference in nfs3svc_encode_getaclres 2024-11-19 12:27:42 +01:00
nfs3proc.c NFSD: Reduce svc_rqst::rq_pages churn during READDIR operations 2024-11-19 12:27:34 +01:00
nfs3xdr.c NFSD: Clean up NFSDDBG_FACILITY macro 2024-11-19 12:27:36 +01:00
nfs4acl.c
nfs4callback.c nfsd: rpc_peeraddr2str needs rcu lock 2024-11-19 12:27:39 +01:00
nfs4idmap.c
nfs4layouts.c
nfs4proc.c nfsd: remove redundant assignment to pointer 'this' 2024-11-19 12:27:41 +01:00
nfs4recover.c nfsd: Log client tracking type log message as info instead of warning 2024-11-19 12:27:36 +01:00
nfs4state.c nfs: don't allow reexport reclaims 2024-11-19 12:27:44 +01:00
nfs4xdr.c NFSD: Extract the svcxdr_init_encode() helper 2024-11-19 12:27:33 +01:00
nfscache.c NFSD: Optimize DRC bucket pruning 2024-11-19 12:27:47 +01:00
nfsctl.c nfsd: Fix fall-through warnings for Clang 2024-11-19 12:27:37 +01:00
nfsd.h NFSD: delay unmount source's export after inter-server copy completed. 2024-11-19 12:27:39 +01:00
nfsfh.c NFSD: Update the GETATTR3res encoder to use struct xdr_stream 2024-11-19 12:27:33 +01:00
nfsfh.h NFSD: Constify @fh argument of knfsd_fh_hash() 2024-11-19 12:27:38 +01:00
nfsproc.c nfs: don't allow reexport reclaims 2024-11-19 12:27:44 +01:00
nfssvc.c NFSD: delay unmount source's export after inter-server copy completed. 2024-11-19 12:27:39 +01:00
nfsxdr.c NFSD: Clean up NFSDDBG_FACILITY macro 2024-11-19 12:27:36 +01:00
pnfs.h
state.h nfsd: track filehandle aliasing in nfs4_files 2024-11-19 12:27:37 +01:00
stats.c nfsd: protect concurrent access to nfsd stats counters 2024-11-19 12:27:31 +01:00
stats.h nfsd: report per-export stats 2024-11-19 12:27:31 +01:00
trace.c NFSD: Add SPDX header for fs/nfsd/trace.c 2024-11-19 12:27:20 +01:00
trace.h NFSD: Prevent a possible oops in the nfs_dirent() tracepoint 2024-11-19 12:27:41 +01:00
vfs.c NFSD: remove vanity comments 2024-11-19 12:27:44 +01:00
vfs.h NFSD: Update the NFSv3 ACCESS3res encoder to use struct xdr_stream 2024-11-19 12:27:33 +01:00
xdr.h NFSD: Clean up after updating NFSv2 ACL encoders 2024-11-19 12:27:35 +01:00
xdr3.h NFSD: Clean up after updating NFSv3 ACL encoders 2024-11-19 12:27:35 +01:00
xdr4.h NFSD add vfs_fsync after async copy is done 2024-11-19 12:27:39 +01:00
xdr4cb.h