From: Harry Yoo <harry@kernel.org>
To: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>
Cc: Hao Li <hao.li@linux.dev>, Christoph Lameter <cl@gentwo.org>,
David Rientjes <rientjes@google.com>,
Roman Gushchin <roman.gushchin@linux.dev>,
"David Hildenbrand (Arm)" <david@kernel.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Chris Mason <mason@kernel.org>,
stable@vger.kernel.org
Subject: Re: [PATCH 3/4] mm/slab: keep caches that drop debug flags unmergeable
Date: Mon, 30 Nov 2026 15:14:37 +0000 [thread overview]
Message-ID: <aw2SILdLhNrtW5_D@thinkstation> (raw)
In-Reply-To: <20261127-slab-ai-fixes-v1-3-cf13b6be6692@kernel.org>
On Fri, Nov 27, 2026 at 09:12:32PM +0100, Vlastimil Babka (SUSE) wrote:
> From: Chris Mason <mason@kernel.org>
>
> When slab_debug boot parameter contains the O flag and a list of caches,
> two caches can get the same id in /sys/kernel/slab, so sysfs warns about
> a duplicate filename and one of them is missing there as a result.
>
> create_unique_id() builds the id of a mergeable cache from its size and
> flags, so caches that are mergeable and result in the same unique id
> must get merged - otherwise a duplicate id would try to be created.
>
> But find_mergeable() doesn't merge a new cache that has (at that point)
> debug flags, and with O do_kmem_cache_create() later drops the flags
> that store metadata if they raise the minimum slab order, and the cache
> can become mergeable again, but too late. An example with the id:
>
> slab_debug=OU,sgpool-128
>
> biovec-max mergeable :0004096
> sgpool-128 has U, so not merged into biovec-max
> later U dropped, so mergeable :0004096
>
> sysfs_slab_add() has a check for such caches since commit 11066386efa6
> ("slub: fix sysfs duplicate filename creation when slub_debug=O") but it
> tests only the global slub_debug, and flags given for a list of caches
> don't end up there.
>
> The fix used here is to mark the cache unmergeable when its debug flags
> are dropped. With that, we can also effectively revert commit
> 11066386efa6 since the global slub_debug is covered by this fix too.
>
> Ideally we would evaluate mergeability with the O flag precisely
> (dropping the U soon enough to merge) but that would be a more involved
> change and probably not worth the effort.
>
> [vbabka: revert 11066386efa6, tweak commit message]
>
> Fixes: e17f1dfba37b ("mm, slub: extend slub_debug syntax for multiple blocks")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Chris Mason <mason@kernel.org>
> Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
> Co-developed-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
> Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
> ---
Looks good to me,
Reviewed-by: Harry Yoo (Meta) <harry@kernel.org>
--
Cheers,
Harry / Hyeonggon
next prev parent reply other threads:[~2026-11-30 15:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 20:12 [PATCH 0/4] slab AI fixes Vlastimil Babka (SUSE)
2026-11-27 20:12 ` [PATCH 1/4] mm/slab: drop __GFP_NOFAIL when refilling sheaves Vlastimil Babka (SUSE)
2026-11-30 14:10 ` Harry Yoo
2026-11-27 20:12 ` [PATCH 2/4] mm/slab: handle __GFP_NOFAIL better with prefilled sheaves Vlastimil Babka (SUSE)
2026-11-27 21:15 ` sashiko-bot
2026-11-30 14:58 ` Harry Yoo
2026-11-27 20:12 ` [PATCH 3/4] mm/slab: keep caches that drop debug flags unmergeable Vlastimil Babka (SUSE)
2026-11-27 21:15 ` sashiko-bot
2026-11-30 15:14 ` Harry Yoo [this message]
2026-11-27 20:12 ` [PATCH 4/4] mm/slab: clear stale layout values in calculate_sizes() Vlastimil Babka (SUSE)
2026-11-27 21:16 ` sashiko-bot
2026-11-30 15:31 ` Harry Yoo
2026-12-01 18:05 ` Vlastimil Babka (SUSE)
2026-11-30 15:26 ` 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=aw2SILdLhNrtW5_D@thinkstation \
--to=harry@kernel.org \
--cc=cl@gentwo.org \
--cc=david@kernel.org \
--cc=hao.li@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mason@kernel.org \
--cc=rientjes@google.com \
--cc=roman.gushchin@linux.dev \
--cc=stable@vger.kernel.org \
--cc=vbabka@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.