Re: [PATCH] Revert "ptdesc: remove references to folios from __pagetable_ctor() and pagetable_dtor()"

From: Axel Rasmussen

Date: Wed Feb 25 2026 - 16:52:20 EST


On Wed, Feb 25, 2026 at 11:31 AM Johannes Weiner <hannes@xxxxxxxxxxx> wrote:
>
> On Tue, Feb 24, 2026 at 04:24:34PM -0800, Axel Rasmussen wrote:
> > This change swapped out mod_node_page_state for lruvec_stat_add_folio.
> > But, these two APIs are not interchangeable: the lruvec version also
> > increments memcg stats, in addition to "global" pgdat stats.
> >
> > So after this change, the "pagetables" memcg stat in memory.stat always
> > yields "0", which is a userspace visible regression.
> >
> > I tried to look for a refactor where we add a variant of
> > lruvec_stat_mod_folio which takes a pgdat and a memcg instead of a
> > folio, to try to adhere to the spirit of the original patch. But at the
> > end of the day this just means we have to call
> > folio_memcg(ptdesc_folio(ptdesc)) anyway, which doesn't really
> > accomplish much.
> >
> > This regression is visible in master as well as 6.18 stable, so CC
> > stable too.
> >
> > Fixes: f0c92726e89f ("ptdesc: remove references to folios from __pagetable_ctor() and pagetable_dtor()")
> > Cc: stable@xxxxxxxxxxxxxxx
> > Signed-off-by: Axel Rasmussen <axelrasmussen@xxxxxxxxxx>
>
> Acked-by: Johannes Weiner <hannes@xxxxxxxxxxx>
>
> Willy's cleanup proposal looks good to me too, but this is more
> straight forward to backport to stable.

Thanks all for taking a look! I feel similarly, the other series looks
reasonable (modulo a couple of fixups pointed out in the other
thread), but at least for 6.18 / stable I would mildly prefer to just
do the simpler thing and put the status quo back. (Especially since
the other approach needs a bit more tweaking.)