From 6e9be217a3cecbd8e8a5beec2aeba4ae9ebd2af9 Mon Sep 17 00:00:00 2001 From: Kairui Song Date: Tue, 28 Apr 2026 02:06:58 +0800 Subject: [PATCH] mm/mglru: use a smaller batch for reclaim With a fixed number to reclaim calculated at the beginning, making each following step smaller should reduce the lock contention and avoid over-aggressive reclaim of folios, as it will abort earlier when the number of folios to be reclaimed is reached. Link: https://lore.kernel.org/20260428-mglru-reclaim-v7-7-02fabb92dc43@tencent.com Signed-off-by: Kairui Song Reviewed-by: Axel Rasmussen Reviewed-by: Chen Ridong Reviewed-by: Baolin Wang Reviewed-by: Barry Song Cc: Chris Li Cc: David Hildenbrand Cc: David Stevens Cc: Johannes Weiner Cc: Kalesh Singh Cc: Leno Hou Cc: Lorenzo Stoakes Cc: Michal Hocko Cc: Shakeel Butt Cc: Suren Baghdasaryan Cc: Vernon Yang Cc: Wei Xu Cc: Yafang Cc: Yuanchu Xie Cc: Yu Zhao Signed-off-by: Andrew Morton --- mm/vmscan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 32ffbb557e15..6128b191b81d 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -5011,7 +5011,7 @@ static bool try_to_shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc) break; } - nr_batch = min(nr_to_scan, MAX_LRU_BATCH); + nr_batch = min(nr_to_scan, MIN_LRU_BATCH); delta = evict_folios(nr_batch, lruvec, sc, swappiness); if (!delta) break; -- 2.47.3