Re: [sched-devel/latest] WARNING: at mm/slub.c:2443

From: Pekka J Enberg
Date: Tue Apr 22 2008 - 13:27:37 EST


On Tue, 22 Apr 2008, Ingo Molnar wrote:
> * Frans Pop <elendil@xxxxxxxxx> wrote:
>
> > I got the following warning while running sched-devel/latest.
> >
> > I was not doing any tracing at that point (for the glibc compilation
> > issue). I suspect it was while I was using a KDE application (amarok)
> > as the desktop froze for a few seconds at one point.
>
> i think this message is harmless to system stability.
>
> Cc:-ing USB folks as the kmem_cache_destroy() comes from
> drivers/usb/mon/mon_text.c.
>
> Context: SLUB recently started warning about caches that get destroyed
> with still outstanding allocations.
>
> Pekka, it might make sense to turn this SLUB warning into something more
> specific? It does seem to trigger in practice.

Oh absolutely. Something like this?

[PATCH] slub: improve kmem_cache_destroy() error message

As pointed out by Ingo, the SLUB warning of calling kmem_cache_destroy()
with cache that still has objects triggers in practice. So turn this
WARN_ON() into a nice SLUB specific error message to avoid people
confusing it to a SLUB bug.

Cc: Ingo Molnar <mingo@xxxxxxx>
Cc: Christoph Lameter <clameter@xxxxxxx>
Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxxxxxx>
---

diff --git a/mm/slub.c b/mm/slub.c
index 7f8aaa2..c372e88 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2426,8 +2426,11 @@ void kmem_cache_destroy(struct kmem_cache *s)
if (!s->refcount) {
list_del(&s->list);
up_write(&slub_lock);
- if (kmem_cache_close(s))
- WARN_ON(1);
+ if (kmem_cache_close(s)) {
+ printk(KERN_ERR "SLUB %s: %s called for cache that "
+ "still has objects.\n", s->name, __func__);
+ dump_stack();
+ }
sysfs_slab_remove(s);
} else
up_write(&slub_lock);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/