[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <165643965013.84360.5320447476976778288.stgit@manet.1015granger.net>
Date: Tue, 28 Jun 2022 14:07:30 -0400
From: Chuck Lever <chuck.lever@...cle.com>
To: linux-nfs@...r.kernel.org, netdev@...r.kernel.org
Cc: david@...morbit.com, jlayton@...hat.com, tgraf@...g.ch
Subject: [PATCH v2 16/31] NFSD: Fix the filecache LRU shrinker
Without LRU item rotation, the shrinker visits only a few items on
the end of the LRU list, and those would always be long-term OPEN
files for NFSv4 workloads. That makes the filecache shrinker
completely ineffective.
Adopt the same strategy as the inode LRU by using LRU_ROTATE.
Suggested-by: Dave Chinner <david@...morbit.com>
Signed-off-by: Chuck Lever <chuck.lever@...cle.com>
---
fs/nfsd/filecache.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c
index 6e9e186334ab..bd6ba63f69ae 100644
--- a/fs/nfsd/filecache.c
+++ b/fs/nfsd/filecache.c
@@ -452,6 +452,7 @@ nfsd_file_dispose_list_delayed(struct list_head *dispose)
*
* Return values:
* %LRU_REMOVED: @item was removed from the LRU
+ * %LRU_ROTATED: @item is to be moved to the LRU tail
* %LRU_SKIP: @item cannot be evicted
*/
static enum lru_status
@@ -490,7 +491,7 @@ nfsd_file_lru_cb(struct list_head *item, struct list_lru_one *lru,
if (test_and_clear_bit(NFSD_FILE_REFERENCED, &nf->nf_flags)) {
trace_nfsd_file_gc_referenced(nf);
- return LRU_SKIP;
+ return LRU_ROTATE;
}
if (!test_and_clear_bit(NFSD_FILE_HASHED, &nf->nf_flags)) {
@@ -532,7 +533,7 @@ nfsd_file_gc(void)
unsigned long ret;
ret = list_lru_walk(&nfsd_file_lru, nfsd_file_lru_cb,
- &dispose, LONG_MAX);
+ &dispose, list_lru_count(&nfsd_file_lru));
trace_nfsd_file_gc_removed(ret, list_lru_count(&nfsd_file_lru));
nfsd_file_gc_dispose_list(&dispose);
}
Powered by blists - more mailing lists