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

Kairui Song <[email protected]>
Newsgroups org.kvack.linux-mm,org.kernel.vger.cgroups,org.kernel.vger.linux-kernel
Message-ID <aow8Z-fdVhy6mQ0x@KASONG-MC4>
On Wed, Aug 19, 2026 at 05:18:51PM +0800, Baolin Wang wrote:
> 
> 
> On 8/18/26 1:38 PM, Kairui Song via B4 Relay wrote:
> > From: Kairui Song <[email protected]>
> > 
> > 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 <[email protected]>
> > Reviewed-by: Baoquan He <[email protected]>
> > ---
> 
> LGTM. One nit below.
> Reviewed-by: Baolin Wang <[email protected]>
> 
> >   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:)

Thanks for the info! I'll keep this line untouched then, my editors auto
indent always align any code I touched to the open bracket that's why this
line is changed :)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.