Re: [PATCH v6 08/18] mm/mglru: make folio lru referenced times count a generic API

From: David Hildenbrand (Arm)

Date: Wed Nov 25 2026 - 05:16:00 EST


On 11/23/26 19:53, Kairui Song via B4 Relay wrote:
> From: Kairui Song <kasong@xxxxxxxxxxx>
>
> Pure code shuffle, no behavior change.
>
> Make the folio LRU refs helpers available regardless of CONFIG_LRU_GEN.
> Without MGLRU the extra bits are never set, so they are inert. Move the
> lru_gen_* helpers into the CONFIG_LRU_GEN section. This prepares for
> unifying the API for checking folio referenced and workingset status.
>
> folio_migrate_lru_refs() now migrates the complete refs count,
> including PG_workingset (bit 1 of the encoding), bitwise identical to
> the direct copy dropped from folio_migrate_flags().
>
> lru_set_refs_flags() skips the nonexistent mask bits when
> LRU_REFS_WIDTH collapses to 0, preserving the two independent flags for
> !CONFIG_LRU_GEN builds.
>
> Tested-by: Zhao Zhenzhuo <zhaozhengzhuo@xxxxxxxxxxxxx>
> Reviewed-by: Kunwu Chan <kunwu.chan@xxxxxxxxx>
> Tested-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Signed-off-by: Kairui Song <kasong@xxxxxxxxxxx>
> ---
> include/linux/mm_inline.h | 55 ++++++++++++++++++++++++-----------------------

I'm starting to feel like all of these mglru/reclaim thingies should go into a
dedicated helper.

Can you do that as a prio cleanup in this series, so we don't have to mess with
mm_inline.h in later patches anymore?

On related notes, can we move mglru stuff into a mglru.c ?

--
Cheers,

David