Re: [PATCH v5 2/6] mm/slab: Plumb kmem_buckets into __do_kmalloc_node()

From: Vlastimil Babka
Date: Thu Jun 20 2024 - 16:44:29 EST


On 6/20/24 8:46 PM, Kees Cook wrote:
> On Thu, Jun 20, 2024 at 03:37:31PM +0200, Vlastimil Babka wrote:
>> On 6/20/24 3:08 PM, Vlastimil Babka wrote:
>> > On 6/19/24 9:33 PM, Kees Cook wrote:
>> > I was wondering why I don't see the buckets in slabinfo and turns out it was
>> > SLAB_MERGE_DEFAULT. It would probably make sense for SLAB_MERGE_DEFAULT to
>> > depends on !SLAB_BUCKETS now as the merging defeats the purpose, wdyt?
>>
>> Hm I might have been just blind, can see them there now. Anyway it probably
>> doesn't make much sense to have SLAB_BUCKETS and/or RANDOM_KMALLOC_CACHES
>> together with SLAB_MERGE_DEFAULT?
>
> It's already handled so that the _other_ caches can still be merged if
> people want it. See new_kmalloc_cache():
>
> #ifdef CONFIG_RANDOM_KMALLOC_CACHES
> if (type >= KMALLOC_RANDOM_START && type <= KMALLOC_RANDOM_END)
> flags |= SLAB_NO_MERGE;
> #endif

OK