Re: [PATCH v3] mm/shrinker: allocate shrinker_info_unit from a dedicated kmem_cache
From: Muchun Song
Date: Mon Oct 19 2026 - 22:33:09 EST
> On Oct 20, 2026, at 00:11, Konstantin Khorenko <khorenko@xxxxxxxxxxxxx> wrote:
>
> shrinker_info_unit holds BITS_PER_LONG atomic_long_t of deferred work
> plus a one-word bitmap, 520 bytes on 64-bit. kzalloc_node() takes it
> from kmalloc-1k, so almost half of every unit is padding.
>
> Allocate the units from a cache of their own, sized to the unit. The
> cache is not cache-line aligned: the counters of a unit already share
> cache lines between shrinkers, and aligning the unit would only keep
> neighbouring units off each other's boundary line, at the cost of part
> of the saving.
>
> Suggested-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Assisted-by: LLM
> Signed-off-by: Konstantin Khorenko <khorenko@xxxxxxxxxxxxx>
Acked-by: Muchun Song <muchun.song@xxxxxxxxx>
Thanks.