Re: [PATCH] mm/slub: allocate sheaves on local memory nodes
From: Hao Li
Date: Tue May 26 2026 - 04:03:07 EST
On Tue, May 26, 2026 at 03:56:58PM +0900, Harry Yoo wrote:
>
>
> On 5/25/26 5:13 PM, Hao Li wrote:
> > Sheaves are per-CPU allocator metadata and their object arrays are accessed
> > from the local fast paths. Allocate them with a NUMA node hint instead of
> > using plain kzalloc(). While no measurable performance improvement was
> > observed, this approach is theoretically correct.
> >
> > During bootstrap we allocate sheaves for all possible CPUs before every
> > possible CPU has an initialized cpu_to_mem() value, so compute the
> > memory node from local_memory_node(cpu_to_node(cpu)) just like
> > what __build_all_zonelists does.
>
>
> What about sheaves for non-kmalloc-normal caches that are allocated &
> initialized by init_percpu_sheaves()?
Ah, good catch! Thanks for the reminder! I completely overlooked this, which
unfortunately means most non-kmalloc caches have been missing out on the
benefits of this patch.
init_percpu_sheaves() also contain for_each_possible_cpu loops. It should also
retrieve the node id from the cpu idx, rather than relying on numa_mem_id()
inside alloc_empty_sheaf().
>
> Would addressing above change "no measurable performance impact was
> observed"?
It looks like we should get some performance gains now. (Hope so:))
--
Thanks,
Hao