Re: [PATCH v5 11/17] mm/damon: convert to LRU refs based operations for MGLRU

From: KunWu Chan

Date: Fri Nov 20 2026 - 03:21:48 EST


On Thu, Nov 19, 2026 at 5:04 AM Kairui Song via B4 Relay
<devnull+kasong.tencent.com@xxxxxxxxxx> wrote:
>
> From: Kairui Song <kasong@xxxxxxxxxxx>
>
> damon_pa_pageout() cleared PG_referenced directly, which under MGLRU
> corrupts the folio's refs count. That flag is now
> bit 0 of the count (LRU_REFS_FLAGS).
>
> Reset the count instead under MGLRU.
>
> Tested-by: Zhao Zhenzhuo <zhaozhengzhuo@xxxxxxxxxxxxx>
> Signed-off-by: Kairui Song <kasong@xxxxxxxxxxx>
> ---
> mm/damon/paddr.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c
> index e89cb14ee17b..411e1d557ba3 100644
> --- a/mm/damon/paddr.c
> +++ b/mm/damon/paddr.c
> @@ -279,7 +279,8 @@ static unsigned long damon_pa_pageout(struct damon_region *r,
> else
> *sz_filter_passed += folio_size(folio) / addr_unit;
>
> - folio_clear_referenced(folio);
> + /* The region is cold, better drop the hotness info. */
> + folio_clear_lru_refs(folio);
> folio_test_clear_young(folio);
> if (!folio_isolate_lru(folio))
> goto put_folio;
>
> --
> 2.56.1
>
>

Reviewed-by: Kunwu Chan <kunwu.chan@xxxxxxxxx>

Thanks,
Kunwu