Re: [PATCH] mm/zsmalloc: keep fullness stats consistent with CONFIG_ZSMALLOC_STAT
From: Nhat Pham
Date: Fri Nov 06 2026 - 11:44:47 EST
On Fri, Nov 6, 2026 at 2:56 AM Xueyuan Chen <xueyuan.chen21@xxxxxxxxx> wrote:
>
> The fullness-group counters are only used by the debugfs classes report,
> which is enabled by CONFIG_ZSMALLOC_STAT. However, these counters are
> stored and updated even when the option is disabled.
>
> Make the counter storage and updates conditional on CONFIG_ZSMALLOC_STAT.
> Keep ZS_OBJS_ALLOCATED and ZS_OBJS_INUSE, since zs_can_compact()
> still needs these counters.
>
> The behavior with CONFIG_ZSMALLOC_STAT=y remains unchanged.
Do we need CONFIG_ZSMALLOC_STAT in the first place? Is the overhead that high?
Also we already have a #ifdef CONFIG_ZSMALLOC_STAT section. Can we
just move these helpers inside it, and provide no-op skeletons in
!CONFIG_ZSMALLOC_STAT case?
And if we're going to have CONFIG_ZSMALLOC_STAT, anything else can we
wrap in CONFIG_ZSMALLOC_STAT? stat field of struct size_class? struct
zs_size_stat's definition?