Re: [PATCH v3 07/10] mm, slab: convert CONFIG_SLUB_TINY checks to kmem_cache_debug()
From: Harry Yoo
Date: Tue Nov 10 2026 - 09:15:19 EST
On Thu, Nov 05, 2026 at 09:43:56AM +0100, Vlastimil Babka (SUSE) wrote:
> CONFIG_SLUB_TINY shares several slowpaths with debugging as both of them
> avoid percpu caching of objects. With the goal of replacing the config
> with a boot-time decision, extend this sharing by hooking
> slab_tiny_enabled into kmem_cache_debug() check itself.
>
> This is made possible by the new SLAB_DEBUG_NOOP debug flag. Make
> slub_debug_enabled static key always available (not just with
> CONFIG_SLUB_DEBUG enabled) and have slab_tiny_enabled add
> SLAB_DEBUG_NOOP to all caches in kmem_cache_flags(). Do this also in the
> CONFIG_SLUB_DEBUG variant, which is currently exclusive with
> CONFIG_SLUB_TINY, but that will be lifted later.
>
> Remove the various IS_ENABLED(CONFIG_SLUB_TINY) checks that
> complement kmem_cache_debug() checks as they are no longer necessary.
>
> While removing/adjusting the CONFIG_SLUB_DEBUG #ifdefs, also convert
> CONFIG_SLUB_DEBUG_ON to *_STATIC_KEY_MAYBE().
>
> Signed-off-by: Vlastimil Babka (SUSE) <vbabka@xxxxxxxxxx>
> ---
Nice cleanup!
Looks good to me,
Reviewed-by: Harry Yoo (Meta) <harry@xxxxxxxxxx>
> diff --git a/mm/slub.c b/mm/slub.c
> index be4e1f193295..1b7626645068 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -7874,7 +7870,7 @@ static int init_percpu_sheaves(struct kmem_cache *s)
> * cache.
> *
> * We keep bootstrap_sheaf for kmem_cache and kmem_cache_node,
> - * caches with debug enabled, and all caches with SLUB_TINY.
> + * and caches with debugging enabled.
> * For kmalloc caches it's used temporarily during the initial
> * bootstrap.
> */
> @@ -8757,8 +8753,10 @@ void __init kmem_cache_init(void)
>
> slab_obj_ext_has_codetag_init();
>
> - if (slab_tiny_enabled)
> + if (slab_tiny_enabled) {
> slab_max_order = 1;
> + static_branch_enable(&slub_debug_enabled);
At first sight I thought this would be unnecessary if we handle
slab_tiny_enabled in setup_slub_debug, but slab_tiny should work
w/o slab_debug= parameter.
--
Cheers,
Harry / Hyeonggon