]> err.no Git - linux-2.6/commitdiff
slub: improve kmem_cache_destroy() error message
authorPekka Enberg <penberg@cs.helsinki.fi>
Wed, 23 Apr 2008 19:31:08 +0000 (22:31 +0300)
committerPekka Enberg <penberg@cs.helsinki.fi>
Sun, 27 Apr 2008 15:26:06 +0000 (18:26 +0300)
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@elte.hu>
Acked-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
mm/slub.c

index 39592b5ce68adc07493ee8ae077f1dcd98839080..378d3f1b548f34ce3afd94d09dbf499596b631d1 100644 (file)
--- 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);