Re: [PATCH RFC 06/19] slab: introduce percpu sheaves bootstrap

From: Vlastimil Babka

Date: Mon Dec 15 2025 - 10:20:23 EST


On 12/15/25 13:17, Hao Li wrote:
> On Thu, Oct 23, 2025 at 03:52:28PM +0200, Vlastimil Babka wrote:
>> @@ -8608,12 +8656,10 @@ int do_kmem_cache_create(struct kmem_cache *s, const char *name,
>>
>> set_cpu_partial(s);
>>
>> - if (s->sheaf_capacity) {
>> - s->cpu_sheaves = alloc_percpu(struct slub_percpu_sheaves);
>> - if (!s->cpu_sheaves) {
>> - err = -ENOMEM;
>> - goto out;
>> - }
>> + s->cpu_sheaves = alloc_percpu(struct slub_percpu_sheaves);
>
> After this change, all SLUB caches enable cpu_sheaves; therefore,
> slab_unmergeable() will always return 1.
>
> int slab_unmergeable(struct kmem_cache *s)
> {
> ...
> if (s->cpu_sheaves)
> return 1;
> ...
> }
>
> Maybe we need to update slab_unmergeable() accordingly..

Yes, I meant to do that but seems I forgot. Thanks for the reminder!

>> + if (!s->cpu_sheaves) {
>> + err = -ENOMEM;
>> + goto out;
>> }
>>
>> #ifdef CONFIG_NUMA
>> @@ -8632,11 +8678,9 @@ int do_kmem_cache_create(struct kmem_cache *s, const char *name,
>> if (!alloc_kmem_cache_cpus(s))
>> goto out;
>>
>> - if (s->cpu_sheaves) {
>> - err = init_percpu_sheaves(s);
>> - if (err)
>> - goto out;
>> - }
>> + err = init_percpu_sheaves(s);
>> + if (err)
>> + goto out;
>>
>> err = 0;
>>
>>
>> --
>> 2.51.1
>>