Skip to content

Commit 8017afd

Browse files
neilbrownchucklever
authored andcommitted
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 <neilb@suse.de> Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
1 parent e8e6f5c commit 8017afd

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

fs/nfsd/filecache.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -537,11 +537,16 @@ nfsd_file_lru_cb(struct list_head *item, struct list_lru_one *lru,
537537
static void
538538
nfsd_file_gc(void)
539539
{
540+
unsigned long ret = 0;
540541
LIST_HEAD(dispose);
541-
unsigned long ret;
542+
int nid;
543+
544+
for_each_node_state(nid, N_NORMAL_MEMORY) {
545+
unsigned long nr = list_lru_count_node(&nfsd_file_lru, nid);
542546

543-
ret = list_lru_walk(&nfsd_file_lru, nfsd_file_lru_cb,
544-
&dispose, list_lru_count(&nfsd_file_lru));
547+
ret += list_lru_walk_node(&nfsd_file_lru, nid, nfsd_file_lru_cb,
548+
&dispose, &nr);
549+
}
545550
trace_nfsd_file_gc_removed(ret, list_lru_count(&nfsd_file_lru));
546551
nfsd_file_dispose_list_delayed(&dispose);
547552
}

0 commit comments

Comments
 (0)