[RFC PATCH v5 11/14] mm/mglru: Reduce LRU lock contention by shrinking folio batches in inc_min_seq
From: Barry Song (Xiaomi)
Date: Thu Oct 22 2026 - 18:03:59 EST
Reduce the number of folios moved from the oldest generation to the
second-oldest generation in each batch. This shortens the time the
lruvec lock is held, allowing concurrent LRU operations to make
progress and significantly reducing LRU lock contention.
Signed-off-by: Barry Song (Xiaomi) <baohua@xxxxxxxxxx>
---
mm/vmscan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/vmscan.c b/mm/vmscan.c
index e8eeeeb76282..555359cc0368 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -4051,7 +4051,7 @@ static inline void flush_lru_batch(struct list_head *head, struct list_head **ba
static bool inc_min_seq(struct lruvec *lruvec, int type, int swappiness)
{
int zone;
- int remaining = MAX_LRU_BATCH;
+ int remaining = MIN_LRU_BATCH;
struct lru_gen_folio *lrugen = &lruvec->lrugen;
int hist = lru_hist_from_seq(lrugen->min_seq[type]);
int new_gen, old_gen = lru_gen_from_seq(lrugen->min_seq[type]);
--
2.34.1