Re: [PATCH v9 13/16] mm/mglru: Reduce LRU lock contention by shrinking folio batches in inc_min_seq

From: Ridong Chen

Date: Wed Nov 25 2026 - 08:01:12 EST




On 11/15/2026 4:08 AM, Barry Song (Xiaomi) wrote:
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 c9e22a5cbb51..6cb905162cba 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -3914,7 +3914,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]);

Reviewed-by: Ridong Chen <ridong.chen@xxxxxxxxx>
Thanks.

--
Best regards
Ridong