Re: [PATCH v2] slab: Warn on duplicate cache names when DEBUG_VM=y

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 12, 2024 at 1:55 AM David Rientjes <rientjes@xxxxxxxxxx> 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.
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 */





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux