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

Rik van Riel riel at surriel.com
Tue Feb 24 14:12:48 PST 2026


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 at linux.alibaba.com>
> 
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 at surriel.com>

-- 
All Rights Reversed.



More information about the linux-arm-kernel mailing list