Re: [PATCH v2 3/7] mm/mglru: enhance cold/hot inversion handling in inc_min_seq()
From: Barry Song
Date: Sun Aug 30 2026 - 00:28:30 EST
On Sun, Aug 30, 2026 at 10:44 AM Ridong Chen <ridong.chen@xxxxxxxxx> wrote:
[...]
> > --- a/mm/vmscan.c
> > +++ b/mm/vmscan.c
> > @@ -3949,9 +3949,12 @@ static bool inc_min_seq(struct lruvec *lruvec, int type, int swappiness)
> > VM_WARN_ON_ONCE_FOLIO(folio_zonenum(folio) != zone, folio);
> >
> > new_gen = __folio_inc_gen(folio, old_gen, &gen_increased);
> > - list_move_tail(&folio->lru, &lrugen->folios[new_gen][type][zone]);
> > - if (gen_increased)
> > + if (gen_increased) {
> > delta += nr_pages;
> > + list_move_tail(&folio->lru, &lrugen->folios[new_gen][type][zone]);
>
> Nit.
> This is a bit confusing to me.
>
> When I read the code, I thought this implementation contradicts what the commit
> message says, which means I thought that we move the folios that have been
> promoted to the tail.
>
> > + } else {
>
> Maybe adding a comment would make it clearer, like:
>
> If gen_increased == false, it means the folio has been promoted, so move it to
> the head.
Good idea. will do it in v3.
>
> > + list_move(&folio->lru, &lrugen->folios[new_gen][type][zone]);
> > + }
>
>
>
> > /* don't count the workingset being lazily promoted */
> > if (refs + workingset != BIT(LRU_REFS_WIDTH) + 1) {
> > int tier = lru_tier_from_refs(refs, workingset);
>
> Overall, looks good to me.
>
> Reviewed-by: Ridong Chen <ridong.chen@xxxxxxxxx>
thanks!
Best Regards
Barry