mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Harry Yoo <harry@kernel.org>
To: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>,
	Hao Li <hao.li@linux.dev>,  Christoph Lameter <cl@gentwo.org>,
	David Rientjes <rientjes@google.com>,
	 Roman Gushchin <roman.gushchin@linux.dev>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	 Conor Dooley <conor@kernel.org>,
	Damien Le Moal <dlemoal@kernel.org>,
	linux-mm@kvack.org,  linux-kernel@vger.kernel.org,
	Alexander Potapenko <glider@google.com>,
	 Andrey Konovalov <andreyknvl@gmail.com>,
	Dmitry Vyukov <dvyukov@google.com>,
	 Vincenzo Frascino <vincenzo.frascino@arm.com>,
	kasan-dev@googlegroups.com
Subject: Re: [PATCH v3 07/10] mm, slab: convert CONFIG_SLUB_TINY checks to kmem_cache_debug()
Date: Tue, 10 Nov 2026 15:12:41 +0100	[thread overview]
Message-ID: <avMkWtwUQkQVkp07@thinkstation> (raw)
In-Reply-To: <20261105-slub_tiny_rework-v3-7-0484ce59eabb@kernel.org>

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@kernel.org>
> ---

Nice cleanup!

Looks good to me,
Reviewed-by: Harry Yoo (Meta) <harry@kernel.org>

> 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

  reply	other threads:[~2026-11-10 14:12 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05  8:43 [PATCH v3 00/10] replace CONFIG_SLUB_TINY with a slab_tiny boot parameter Vlastimil Babka (SUSE)
2026-11-05  8:43 ` [PATCH v3 01/10] slab, kunit: pin test slabs by an extra allocation Vlastimil Babka (SUSE)
2026-11-05 12:59   ` Harry Yoo
2026-11-05  8:43 ` [PATCH v3 02/10] kasan, " Vlastimil Babka (SUSE)
2026-11-05 13:03   ` Harry Yoo
2026-11-05  8:43 ` [PATCH v3 03/10] mm, slab: refactor slab_min/max_order handling Vlastimil Babka (SUSE)
2026-11-05 13:12   ` Harry Yoo
2026-11-05  8:43 ` [PATCH v3 04/10] mm, slab: introduce slab_debug=N Vlastimil Babka (SUSE)
2026-11-05 14:30   ` Harry Yoo
2026-11-05 14:36     ` Vlastimil Babka (SUSE)
2026-11-05 15:02       ` Harry Yoo
2026-11-05  8:43 ` [PATCH v3 05/10] mm, slab: rework KMALLOC_RECLAIM handling of SLUB_TINY Vlastimil Babka (SUSE)
2026-11-08 17:00   ` Harry Yoo
2026-11-05  8:43 ` [PATCH v3 06/10] mm, slab: make SLUB_TINY handling dynamic for sizing decisions Vlastimil Babka (SUSE)
2026-11-08 17:58   ` Harry Yoo
2026-11-05  8:43 ` [PATCH v3 07/10] mm, slab: convert CONFIG_SLUB_TINY checks to kmem_cache_debug() Vlastimil Babka (SUSE)
2026-11-10 14:12   ` Harry Yoo [this message]
2026-11-05  8:43 ` [PATCH v3 08/10] mm, slab: remove remaining compile-time checks for CONFIG_SLUB_TINY Vlastimil Babka (SUSE)
2026-11-10 14:19   ` Harry Yoo
2026-11-05  8:43 ` [PATCH v3 09/10] mm, slab: add slab_tiny boot param Vlastimil Babka (SUSE)
2026-11-10 14:24   ` Harry Yoo
2026-11-05  8:43 ` [PATCH v3 10/10] mm, slab: deprecate CONFIG_SLUB_TINY and reduce its Kconfig effects Vlastimil Babka (SUSE)
2026-11-10 14:39   ` Harry Yoo
2026-11-10 14:46 ` [PATCH v3 00/10] replace CONFIG_SLUB_TINY with a slab_tiny boot parameter Harry Yoo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=avMkWtwUQkQVkp07@thinkstation \
    --to=harry@kernel.org \
    --cc=andreyknvl@gmail.com \
    --cc=cl@gentwo.org \
    --cc=conor@kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=dvyukov@google.com \
    --cc=geert@linux-m68k.org \
    --cc=glider@google.com \
    --cc=hao.li@linux.dev \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=ryabinin.a.a@gmail.com \
    --cc=vbabka@kernel.org \
    --cc=vincenzo.frascino@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®