From: sashiko-bot@kernel.org
To: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>,
"Harry Yoo" <harry@kernel.org>,
"Andrey Ryabinin" <ryabinin.a.a@gmail.com>
Cc: "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, "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 04/10] mm, slab: introduce slab_debug=N
Date: Thu, 05 Nov 2026 13:26:39 +0000 [thread overview]
Message-ID: <sashiko-outbox-199144@kernel.org> (raw)
In-Reply-To: <20261105-slub_tiny_rework-v3-4-0484ce59eabb@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] mm, slab: missing SLAB_DEBUG_NOOP in create_unique_id() causes sysfs collision
--
commit 72eeb0d7d0de3c870ebf6a85a45b89ab817bcdff
Author: Vlastimil Babka (SUSE) <vbabka@kernel.org>
mm, slab: introduce slab_debug=N
This commit introduces a new slab_debug=N (SLAB_DEBUG_NOOP) option that forces
slab debugging slowpaths and zero sheaf capacity without enabling actual debug
checks, while keeping caches mergeable among caches with the same flag and
avoiding disabling printk pointer hashing.
> diff --git a/mm/slab_common.c b/mm/slab_common.c
> index 01c64ef661e7f..6036ce1ac333b 100644
> --- a/mm/slab_common.c
> +++ b/mm/slab_common.c
> @@ -47,12 +47,13 @@ struct kmem_cache *kmem_cache;
> * Any flag that adds per-object metadata should be included,
> * since slab merging can update s->inuse that affects the metadata layout.
> */
> -#define SLAB_NEVER_MERGE (SLAB_DEBUG_FLAGS | SLAB_TYPESAFE_BY_RCU | \
> - SLAB_NOLEAKTRACE | SLAB_FAILSLAB | SLAB_NO_MERGE | \
> - SLAB_OBJ_EXT_IN_OBJ)
> +#define SLAB_NEVER_MERGE ((SLAB_DEBUG_FLAGS & ~SLAB_DEBUG_NOOP) | \
> + SLAB_TYPESAFE_BY_RCU | SLAB_NOLEAKTRACE | SLAB_FAILSLAB | \
> + SLAB_NO_MERGE | SLAB_OBJ_EXT_IN_OBJ)
>
> #define SLAB_MERGE_SAME (SLAB_RECLAIM_ACCOUNT | SLAB_CACHE_DMA | \
> - SLAB_CACHE_DMA32 | SLAB_ACCOUNT | SLAB_MAY_ACCOUNT)
> + SLAB_CACHE_DMA32 | SLAB_ACCOUNT | SLAB_MAY_ACCOUNT | \
> + SLAB_DEBUG_NOOP)
[Severity: Medium]
As reported by Sashiko on RFC v2 [1], when SLAB_DEBUG_NOOP is excluded from
SLAB_NEVER_MERGE and added to SLAB_MERGE_SAME, does create_unique_id() in
mm/slub.c also need to encode SLAB_DEBUG_NOOP into the generated sysfs cache
name?
When SLAB_DEBUG_NOOP is enabled on a subset of mergeable caches (for example
via per-cache slab_debug=N,<cache> boot parameters), find_mergeable() keeps
mergeable caches with SLAB_DEBUG_NOOP separate from otherwise identical
mergeable caches of the same size without SLAB_DEBUG_NOOP.
Because slab_unmergeable() returns 0 for both caches, sysfs_slab_add() calls
create_unique_id() to generate their /sys/kernel/slab/ directory names:
mm/slub.c:create_unique_id() {
...
if (s->flags & SLAB_CACHE_DMA)
*p++ = 'd';
if (s->flags & SLAB_CACHE_DMA32)
*p++ = 'D';
if (s->flags & SLAB_RECLAIM_ACCOUNT)
*p++ = 'a';
if (s->flags & SLAB_CONSISTENCY_CHECKS)
*p++ = 'F';
if (s->flags & SLAB_ACCOUNT)
*p++ = 'A';
if (p != name + 1)
*p++ = '-';
p += snprintf(p, ID_STR_LENGTH - (p - name), "%07u", s->size);
...
}
Since create_unique_id() does not append a character for SLAB_DEBUG_NOOP, both
caches receive the exact same sysfs name, causing kobject_init_and_add() in
sysfs_slab_add() to fail with -EEXIST and trigger a duplicate sysfs filename
warning.
[1] https://lore.kernel.org/r/20261024-slub_tiny_rework-v2-2-bf1419ab5ffd@kernel.org
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261105-slub_tiny_rework-v3-0-0484ce59eabb@kernel.org?part=4
next prev parent reply other threads:[~2026-11-05 13:26 UTC|newest]
Thread overview: 19+ 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 13:26 ` sashiko-bot
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 13:26 ` sashiko-bot [this message]
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-05 8:43 ` [PATCH v3 06/10] mm, slab: make SLUB_TINY handling dynamic for sizing decisions Vlastimil Babka (SUSE)
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-05 8:43 ` [PATCH v3 08/10] mm, slab: remove remaining compile-time checks for CONFIG_SLUB_TINY Vlastimil Babka (SUSE)
2026-11-05 8:43 ` [PATCH v3 09/10] mm, slab: add slab_tiny boot param Vlastimil Babka (SUSE)
2026-11-05 8:43 ` [PATCH v3 10/10] mm, slab: deprecate CONFIG_SLUB_TINY and reduce its Kconfig effects Vlastimil Babka (SUSE)
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=sashiko-outbox-199144@kernel.org \
--to=sashiko-bot@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=harry@kernel.org \
--cc=kasan-dev@googlegroups.com \
--cc=linux-mm@kvack.org \
--cc=rientjes@google.com \
--cc=roman.gushchin@linux.dev \
--cc=ryabinin.a.a@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
--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