Re: [PATCH RFC v2 03/20] mm/slab: make caches with sheaves mergeable
From: Vlastimil Babka
Date: Fri Jan 16 2026 - 06:01:26 EST
On 1/16/26 09:46, Harry Yoo wrote:
> On Fri, Jan 16, 2026 at 08:24:02AM +0100, Vlastimil Babka wrote:
>> On 1/16/26 01:22, Suren Baghdasaryan wrote:
>> > On Mon, Jan 12, 2026 at 3:17 PM Vlastimil Babka <vbabka@xxxxxxx> wrote:
>> >> @@ -337,6 +331,13 @@ struct kmem_cache *__kmem_cache_create_args(const char *name,
>> >> flags &= ~SLAB_DEBUG_FLAGS;
>> >> #endif
>> >>
>> >> + /*
>> >> + * Caches with specific capacity are special enough. It's simpler to
>> >> + * make them unmergeable.
>> >> + */
>> >> + if (args->sheaf_capacity)
>> >> + flags |= SLAB_NO_MERGE;
>> >
>> > So, this is very subtle and maybe not that important but the comment
>> > for kmem_cache_args.sheaf_capacity claims "When slub_debug is enabled
>> > for the cache, the sheaf_capacity argument is ignored.". With this
>> > change this argument is not completely ignored anymore... It sets
>> > SLAB_NO_MERGE even if slub_debug is enabled, doesn't it?
>>
>> True, but the various debug flags set by slub_debug also prevent merging so
>> it doesn't change the outcome.
>
> nit: except for slub_debug=F (SLAB_CONSISTENCY_CHECKS), since it doesn't
> prevent merging (it's in SLAB_DEBUG_FLAGS but not in SLAB_NEVER_MERGE).
Hm right. But I think that's wrong then and it should be there.
SLAB_CONSISTENCY_CHECKS is enough to stop using the fastpaths (both
before/after sheaves) so it should be a reason not to merge.