From 8017afd66cbc98b838ac6d5b469e733a608a1211 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Tue, 18 Feb 2025 10:39:34 -0500 Subject: [PATCH] nfsd: filecache: use list_lru_walk_node() in nfsd_file_gc() list_lru_walk() is only useful when the aim is to remove all elements from the list_lru. It will repeatedly visit rotated elements of the first per-node sublist before proceeding to subsequent sublists. This patch changes nfsd_file_gc() to use list_lru_walk_node() and list_lru_count_node() on each NUMA node. Signed-off-by: NeilBrown Reviewed-by: Jeff Layton Signed-off-by: Chuck Lever --- fs/nfsd/filecache.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c index 604a2aef5ff7..79de1638415f 100644 --- a/fs/nfsd/filecache.c +++ b/fs/nfsd/filecache.c @@ -537,11 +537,16 @@ nfsd_file_lru_cb(struct list_head *item, struct list_lru_one *lru, static void nfsd_file_gc(void) { + unsigned long ret = 0; LIST_HEAD(dispose); - unsigned long ret; + int nid; + + for_each_node_state(nid, N_NORMAL_MEMORY) { + unsigned long nr = list_lru_count_node(&nfsd_file_lru, nid); - ret = list_lru_walk(&nfsd_file_lru, nfsd_file_lru_cb, - &dispose, list_lru_count(&nfsd_file_lru)); + ret += list_lru_walk_node(&nfsd_file_lru, nid, nfsd_file_lru_cb, + &dispose, &nr); + } trace_nfsd_file_gc_removed(ret, list_lru_count(&nfsd_file_lru)); nfsd_file_dispose_list_delayed(&dispose); } -- 2.50.1