Re: [PATCH v3] mm/shrinker: allocate shrinker_info_unit from a dedicated kmem_cache
From: Harry Yoo
Date: Mon Oct 19 2026 - 15:33:02 EST
On Mon, Oct 19, 2026 at 06:11:44PM +0200, Konstantin Khorenko 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>
> ---
Looks good to me,
Reviewed-by: Harry Yoo (Meta) <harry@xxxxxxxxxx>
--
Cheers,
Harry / Hyeonggon