Re: [PATCH v9 13/16] mm/mglru: Reduce LRU lock contention by shrinking folio batches in inc_min_seq
From: Kairui Song
Date: Sun Nov 15 2026 - 10:53:44 EST
On Sun, Nov 15, 2026 at 4:09 AM Barry Song (Xiaomi) <baohua@xxxxxxxxxx> 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]);
> --
> 2.39.3 (Apple Git-146)
Reviewed-by: Kairui Song <kasong@xxxxxxxxxxx>