]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
slab: decouple pointer to barn from kmem_cache_node
authorVlastimil Babka (SUSE) <vbabka@kernel.org>
Wed, 11 Mar 2026 08:25:55 +0000 (09:25 +0100)
committerVlastimil Babka (SUSE) <vbabka@kernel.org>
Thu, 19 Mar 2026 12:22:39 +0000 (13:22 +0100)
commit5ba6bc27b1f99b35aa528409a8e223136c59e0af
treeacda8be6c589942d21b7e3a7f0a5b29f2a625447
parent69d73421b76e3d952076be2e17cea42de90d126a
slab: decouple pointer to barn from kmem_cache_node

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).

Thus decouple the two structures. In struct kmem_cache we have an array
for kmem_cache_node pointers that appears to be sized MAX_NUMNODES but
the actual size calculation in kmem_cache_init() uses nr_node_ids.
Therefore we can't just add another array of barn pointers. Instead
change the array to newly introduced struct kmem_cache_per_node_ptrs
holding both kmem_cache_node and barn pointer.

Adjust barn accessor and allocation/initialization code accordingly. For
now no functional change intended, barns are created 1:1 together with
kmem_cache_nodes.

Link: https://patch.msgid.link/20260311-b4-slab-memoryless-barns-v1-1-70ab850be4ce@kernel.org
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Reviewed-by: Harry Yoo <harry.yoo@oracle.com>
Reviewed-by: Hao Li <hao.li@linux.dev>
mm/slab.h
mm/slub.c