Re: [PATCH v3 06/21] slab: introduce percpu sheaves bootstrap

Vlastimil Babka
2026-01-21T10:52:53Z

On 1/17/26 03:11, Suren Baghdasaryan wrote:
>> @@ -7379,7 +7405,7 @@ void kmem_cache_free_bulk(struct kmem_cache *s, size_t size, void **p)
>> * freeing to sheaves is so incompatible with the detached freelist so
>> * once we go that way, we have to do everything differently
>> */
>> - if (s && s->cpu_sheaves) {
>> + if (s && cache_has_sheaves(s)) {
>> free_to_pcs_bulk(s, size, p);
>> return;
>> }
>> @@ -7490,8 +7516,7 @@ int kmem_cache_alloc_bulk_noprof(struct kmem_cache *s, gfp_t flags, size_t size,
>> size--;
>> }
>>
>> - if (s->cpu_sheaves)
>> - i = alloc_from_pcs_bulk(s, size, p);
>> + i = alloc_from_pcs_bulk(s, size, p);
>
> Doesn't the above change make this fastpath a bit longer? IIUC,
> instead of bailing out right here we call alloc_from_pcs_bulk() and
> bail out from there because pcs->main->size is 0.

But only for caches with no sheaves, and that should be the exception. So
the fast path avoids checks. We're making the slowpath longer. The strategy
is the same with single-object alloc, and described in the changelog. Or
what am I missing?