Re: [PATCH 1/3] slab: decouple pointer to barn from kmem_cache_node

Vlastimil Babka (SUSE)
2026-04-13T12:08:03Z

On 4/10/26 12:12, Christoph Lameter (Ampere) wrote:
> On Wed, 11 Mar 2026, Vlastimil Babka (SUSE) wrote:
>
>> The pointer to barn currently exists in struct kmem_cache_node. That
>> struct is instantiated for every NUMA node with memory, but we want to
>> have a barn for every online node (including memoryless).
>
> Is this breaking the 1-1 association of kmem_cache to numa
> nodes?

Assuming you mean association of kmem_cache_node to NUMA non-memoryless nodes?

Indeed if we didn't separate pointer to barn from kmem_cache_node and
started instantiating kmem_cache_node on memoryless NUMA nodes, it would
break this 1-1 association. But with the separation, it shouldn't.

> I would think you needd local per cpu queues on a memoryless node
> for performance but not fake node structures.

"barn" is only for handling per cpu queues (sheaves), not the other per-node
structures. On memoryless node the sheaves will hold remote objects (as
there are no local objects) so it's fine that there's also barn for sheaves
with remote objects (and empty sheaves).

> Per node access is already
> serialized via locks and therefore slow.
>
> If you break the association of per cpu queues to cpu and kmem_cache_node
> to numa_nodes then the code may get complicated.
The sheaves "empty on alloc"/"full on free" handling code would be more
complicated if the barns didn't exist for memoryless nodes, so it's better
if it does. The kmem_cache_node with partial (and other) slab lists keeps
not existing on memoryless nodes.