From: Vlastimil Babka <vbabka@suse.cz>
To: Pedro Falcato <pedro.falcato@gmail.com>,
David Rientjes <rientjes@google.com>
Cc: Christoph Lameter <cl@linux.com>,
Pekka Enberg <penberg@kernel.org>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>,
Andrew Morton <akpm@linux-foundation.org>,
Roman Gushchin <roman.gushchin@linux.dev>,
Hyeonggon Yoo <42.hyeyoo@gmail.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] slab: Warn on duplicate cache names when DEBUG_VM=y
Date: Mon, 26 Aug 2024 21:23:10 +0200 [thread overview]
Message-ID: <6e5f3c82-a18a-4c20-858f-058f44e90ced@suse.cz> (raw)
In-Reply-To: <CAKbZUD293X0hOaqHRKpERpmsMKvvOLqRcQoKyB9mssg41Dhxtw@mail.gmail.com>
On 8/16/24 14:17, Pedro Falcato wrote:
> On Mon, Aug 12, 2024 at 1:55 AM David Rientjes <rientjes@google.com> wrote:
>>
>> On Sun, 11 Aug 2024, Pedro Falcato wrote:
>> > > > + if (kmem_cache_is_duplicate_name(name)) {
>> > > > + /* Duplicate names will confuse slabtop, et al */
>> > > > + pr_warn("%s: name %s already exists as a cache\n", __func__, name);
>> > >
>> > >
>> > > Shouldn't this be a full WARN_ON() instead of pr_warn()? I assume we'll
>> > > be interested in who is adding the cache when the name already exists.
>> >
>> > panic_on_warn? :)
>> >
>>
>> Would get the problem fixed up pretty fast, no? :)
>>
>> > Personally I don't have anything against WARN_ON, but we've seen that
>> > panic_on_warn is a real thing on real systems, and DEBUG_VM is also
>> > set on real prod configs (like Fedora does/used to do). I've sent out
>> > one or two loose patches for problems I did find in my own testing
>> > around, but there may be many more (e.g some drivers may call
>> > kmem_cache_create repeatedly in some sort of callback, like 9pfs was
>> > doing when mounting; this is not greppable). And I'd guess grepping
>> > for cache names tends to be easy enough?
>> >
>>
>> Can we add a dump_stack() to make this way easier instead of hiding who is
>> creating the duplicate name?
>
>
> Bah, sorry for the delay.
>
> I'm fully in favour of adding a dump_stack(), but it seems like hand
> coding WARN_ON a bit. Oh well.
After some pondering I've decided we should just go with WARN_ON and not do
a hand coded workaround for hypothetical people who run CONFIG_DEBUG_VM
together with panic_on_warn, so I've updated the commit in the slab tree
accordingly.
> If y'all agree, please squash this in (praying gmail doesn't mangle
> this diff, in any case it's a trivial change):
>
> diff --git a/mm/slab_common.c b/mm/slab_common.c
> index 1abe6a577d52..d183655e4b1b 100644
> --- a/mm/slab_common.c
> +++ b/mm/slab_common.c
> @@ -111,6 +111,7 @@ static int kmem_cache_sanity_check(const char
> *name, unsigned int size)
> if (kmem_cache_is_duplicate_name(name)) {
> /* Duplicate names will confuse slabtop, et al */
> pr_warn("%s: name %s already exists as a cache\n",
> __func__, name);
> + dump_stack_lvl(KERN_WARNING);
> }
>
> WARN_ON(strchr(name, ' ')); /* It confuses parsers */
prev parent reply other threads:[~2024-08-26 19:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20240807090746.2146479-1-pedro.falcato@gmail.com>
2024-08-11 20:30 ` [PATCH v2] slab: Warn on duplicate cache names when DEBUG_VM=y David Rientjes
2024-08-11 22:28 ` Pedro Falcato
2024-08-12 0:55 ` David Rientjes
2024-08-16 12:17 ` Pedro Falcato
2024-08-26 19:23 ` Vlastimil Babka [this message]
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=6e5f3c82-a18a-4c20-858f-058f44e90ced@suse.cz \
--to=vbabka@suse.cz \
--cc=42.hyeyoo@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=cl@linux.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=pedro.falcato@gmail.com \
--cc=penberg@kernel.org \
--cc=rientjes@google.com \
--cc=roman.gushchin@linux.dev \
/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;
as well as URLs for NNTP newsgroup(s).