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

From: Baolin Wang

Date: Wed Aug 19 2026 - 05:19:42 EST




On 8/18/26 1:38 PM, Kairui Song via B4 Relay 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.

Signed-off-by: Kairui Song <kasong@xxxxxxxxxxx>
Reviewed-by: Baoquan He <baoquan.he@xxxxxxxxx>
---

LGTM. One nit below.
Reviewed-by: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>

mm/vmscan.c | 29 ++++++++++++-----------------
1 file changed, 12 insertions(+), 17 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 080132997d87..a819be6b7ae9 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -3517,13 +3517,15 @@ static bool suitable_to_scan(int total, int young)
}
static void walk_update_folio(struct lru_gen_mm_walk *walk, struct vm_area_struct *vma,
- struct folio *folio, int new_gen, bool dirty)
+ struct lruvec *lruvec, struct folio *folio, bool dirty)

IIRC, MM maintainers prefer 2 tabs, which is why I changed this earlier:)