Re: [PATCH v3 4/6] mm/mglru: move max_seq read into walk_update_folio

From: Barry Song

Date: Sat Aug 29 2026 - 06:05:53 EST


On Wed, Aug 26, 2026 at 1:53 AM Kairui Song via B4 Relay
<devnull+kasong.tencent.com@xxxxxxxxxx> wrote:
>
> From: Kairui Song <kasong@xxxxxxxxxxx>
>
> walk_pte_range(), walk_pmd_range_locked(), and lru_gen_look_around()
> each read lrugen->max_seq to compute the target generation used by
> walk_update_folio(), then pass it as a parameter. Move the read into
> walk_update_folio() itself so the callers no longer need to compute
> or pass the value.
>
> The max_seq read now happens once per folio update rather than once
> per walk range, so folios always get promoted to the current youngest
> generation.
>
> Reviewed-by: Baoquan He <baoquan.he@xxxxxxxxx>
> Reviewed-by: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>
> Reviewed-by: Ridong Chen <ridong.chen@xxxxxxxxx>
> Signed-off-by: Kairui Song <kasong@xxxxxxxxxxx>
> ---

Reviewed-by: Barry Song <baohua@xxxxxxxxxx>