Re: [PATCH] mm/slub: unify slub stat definitions to simplify metric additions

From: Harry Yoo

Date: Mon Sep 07 2026 - 10:42:08 EST


On Fri, Aug 14, 2026 at 03:17:02PM +0800, Hao Li wrote:
> Currently, adding a new slub stat requires modifying three separate
> locations: stat_item, STAT_ATTR, and slab_attrs. This is inconvenient,
> especially when temporarily adding metrics for debugging during
> development.
>
> This patch borrows the approach from SCHED_FEAT by introducing an ITEM_EXP
> X-macro, which is then temporarily defined as different operations at the
> three locations (stat_item, STAT_ATTR, and slab_attrs) to perform distinct
> macro expansions.
>
> Going forward, adding a new metric only requires adding a single line:
> ITEM_EXP(XXX, xxx)
>
> Signed-off-by: Hao Li <hao.li@xxxxxxxxx>
> ---

Looks good to me,
Reviewed-by: Harry Yoo (Meta) <harry@xxxxxxxxxx>

--
Cheers,
Harry / Hyeonggon