Re: [PATCH 4/5] mm: support batched checking of the young flag for MGLRU

From: Rik van Riel

Date: Tue Feb 24 2026 - 17:13:47 EST


On Tue, 2026-02-24 at 09:56 +0800, Baolin Wang wrote:
> Use the batched helper clear_young_ptes_notify() to check and clear
> the
> young flag to improve the performance during large folio reclamation
> when
> MGLRU is enabled.
>
> Meanwhile, we can also support batched checking the young and dirty
> flag
> when MGLRU walks the mm's pagetable to update the folios' generation
> counter. Since MGLRU also checks the PTE dirty bit, use
> folio_pte_batch_flags()
> with FPB_MERGE_YOUNG_DIRTY set to detect batches of PTEs for a large
> folio.
>
> Then we can remove the ptep_clear_young_notify() since it has no
> users now.
>
> Signed-off-by: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>
>
I'm not entirely happy with how much code is duplicated
between MGLRU and classic LRU, but merging duplicate
functionality seems like a thing for a separate patch.

This one looks good to me.

Reviewed-by: Rik van Riel <riel@xxxxxxxxxxx>

--
All Rights Reversed.