]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
slab: handle kmalloc sheaves bootstrap
authorVlastimil Babka <vbabka@suse.cz>
Fri, 23 Jan 2026 06:52:47 +0000 (07:52 +0100)
committerVlastimil Babka <vbabka@suse.cz>
Thu, 29 Jan 2026 08:22:38 +0000 (09:22 +0100)
commit913ffd3a1bf5d154995c6cfab44994b07b3c103f
treecd496b9cfcb9566d85fb77f7c078acba4750734c
parentf1427a1d64156bb88d84f364855c364af6f67a3b
slab: handle kmalloc sheaves bootstrap

Enable sheaves for kmalloc caches. For other types than KMALLOC_NORMAL,
we can simply allow them in calculate_sizes() as they are created later
than KMALLOC_NORMAL caches and can allocate sheaves and barns from
those.

For KMALLOC_NORMAL caches we perform additional step after first
creating them without sheaves. Then bootstrap_cache_sheaves() simply
allocates and initializes barns and sheaves and finally sets
s->sheaf_capacity to make them actually used.

Afterwards the only caches left without sheaves (unless SLUB_TINY or
debugging is enabled) are kmem_cache and kmem_cache_node. These are only
used when creating or destroying other kmem_caches. Thus they are not
performance critical and we can simply leave it that way.

Reviewed-by: Harry Yoo <harry.yoo@oracle.com>
Reviewed-by: Hao Li <hao.li@linux.dev>
Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
mm/slub.c