]> www.infradead.org Git - users/jedix/linux-maple.git/commit
nfsd: filecache: don't repeatedly add/remove files on the lru list
authorNeilBrown <neilb@suse.de>
Tue, 18 Feb 2025 15:39:36 +0000 (10:39 -0500)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 10 Mar 2025 13:11:07 +0000 (09:11 -0400)
commit56221b42d71781e49dcead6ed34b0766daecf90d
treeae48e73ebe5db1210c66e63f194b4a3744d17dd2
parent64912122a4f86f8c7e232c5b92482b46364c40a2
nfsd: filecache: don't repeatedly add/remove files on the lru list

There is no need to remove a file from the lru every time we access it,
and then add it back.  It is sufficient to set the REFERENCED flag every
time we put the file.  The order in the lru of REFERENCED files is
largely irrelevant as they will all be moved to the end.

With this patch, files are added only when they are allocated (if
want_gc) and they are removed only by the list_lru_(shrink_)walk
callback or when forcibly removing a file.

This should reduce contention on the list_lru spinlock(s) and reduce
memory traffic a little.

Signed-off-by: NeilBrown <neilb@suse.de>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/filecache.c