Re: [PATCH RFC 08/19] slab: handle kmalloc sheaves bootstrap
From: Harry Yoo
Date: Wed Oct 29 2025 - 20:12:07 EST
On Wed, Oct 29, 2025 at 09:06:45PM +0100, Vlastimil Babka wrote:
> 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.
Oh right. it's set to bootstrap_sheaf in init_percpu_sheaves() before
bootstrap_cache_sheaves() is called. Looks good then!
--
Cheers,
Harry / Hyeonggon