Re: [PATCH RFC 08/19] slab: handle kmalloc sheaves bootstrap
From: Vlastimil Babka
Date: Wed Oct 29 2025 - 16:06:47 EST
On 10/29/25 21:06, Vlastimil Babka wrote:
> On 10/27/25 07:12, Harry Yoo wrote:
>>> @@ -8549,6 +8559,74 @@ static struct kmem_cache * __init bootstrap(struct kmem_cache *static_cache)
>>> return s;
>>> }
>>>
>>> +/*
>>> + * Finish the sheaves initialization done normally by init_percpu_sheaves() and
>>> + * init_kmem_cache_nodes(). For normal kmalloc caches we have to bootstrap it
>>> + * since sheaves and barns are allocated by kmalloc.
>>> + */
>>> +static void __init bootstrap_cache_sheaves(struct kmem_cache *s)
>>> +{
>>> + struct kmem_cache_args empty_args = {};
>>> + unsigned int capacity;
>>> + bool failed = false;
>>> + int node, cpu;
>>> +
>>> + capacity = calculate_sheaf_capacity(s, &empty_args);
>>> +
>>> + /* capacity can be 0 due to debugging or SLUB_TINY */
>>> + if (!capacity)
>>> + return;
>>
>> I think pcs->main should still be !NULL in this case?
>
> It will remain to be set to bootstrap_sheaf, and with s->sheaf_capacity
... s->sheaf_capacity remaining 0
> things will continue to work.