Re: [PATCH v4 06/22] slab: add sheaves to most caches

Vlastimil Babka
2026-01-27T17:01:59Z

On 1/27/26 17:34, Liam R. Howlett wrote:
> * Vlastimil Babka <vbabka@suse.cz> [260123 01:53]:
>> In the first step to replace cpu (partial) slabs with sheaves, enable
>> sheaves for almost all caches. Treat args->sheaf_capacity as a minimum,
>> and calculate sheaf capacity with a formula that roughly follows the
>> formula for number of objects in cpu partial slabs in set_cpu_partial().
>>
>> This should achieve roughly similar contention on the barn spin lock as
>> there's currently for node list_lock without sheaves, to make
>> benchmarking results comparable. It can be further tuned later.
>>
>> Don't enable sheaves for bootstrap caches as that wouldn't work. In
>> order to recognize them by SLAB_NO_OBJ_EXT, make sure the flag exists
>> even for !CONFIG_SLAB_OBJ_EXT.
>>
>> This limitation will be lifted for kmalloc caches after the necessary
>> bootstrapping changes.
>>
>> Also do not enable sheaves for SLAB_NOLEAKTRACE caches to avoid
>> recursion with kmemleak tracking (thanks to Breno Leitao).
>>
>> Reviewed-by: Suren Baghdasaryan <surenb@google.com>
>> Reviewed-by: Harry Yoo <harry.yoo@oracle.com>
>> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
>
> Is there a way to force a specific limit to the sheaf capacity if you
> want a lower number than what is calculated in
> calculate_sheaf_capacity()?

No.

> That is, it seems your code always decides
> if the specified sheaf number is smaller right now.

That's right. It shouldn't break anything, AFAICS.

> I'm not sure it's
> practical to want a smaller number though.

Yeah I found no such reason, so until we stumble upon one, we don't need
such support I think?

> Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com>

Thanks!