VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   33 Branches   55 Tags
author: Vlastimil Babka <vbabka@suse.cz> 2021-09-02 14:59:53 -0700 committer: Linus Torvalds <torvalds@linux-foundation.org> 2021-09-03 09:58:17 -0700 commit: 1399af7e54896c774d67f1c1acc491b07149421d parent: 2e786d9e5a2014c327d9b2eec83fa60b16af26f9
Commit Summary:
mm, vmscan: guarantee drop_slab_node() termination
Diffstat:
1 file changed, 2 insertions, 1 deletion
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 1b14a1b2539c..740d03e6dae2 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -939,6 +939,7 @@ out:
 void drop_slab_node(int nid)
 {
 	unsigned long freed;
+	int shift = 0;
 
 	do {
 		struct mem_cgroup *memcg = NULL;
@@ -951,7 +952,7 @@ void drop_slab_node(int nid)
 		do {
 			freed += shrink_slab(GFP_KERNEL, nid, memcg, 0);
 		} while ((memcg = mem_cgroup_iter(NULL, memcg, NULL)) != NULL);
-	} while (freed > 10);
+	} while ((freed >> shift++) > 1);
 }
 
 void drop_slab(void)