Re: [BUG] CONFIG_DEBUG_SLAB broken on SMP

From: Andrew Morton (akpm@digeo.com)
Date: Wed Oct 09 2002 - 14:41:09 EST


Andreas Dilger wrote:
>
> We were tracking down a strange bug in our code that only appeared on
> SMP and not UP, and we thought that CONFIG_DEBUG_SLAB (and the ensuing
> FORCED_DEBUG which enables SLAB_POISON and SLAB_REDZONE) was going to
> catch problems with slab objects, so we were very very confused when a
> test like:
>
> struct foo *obj;
>
> cache = kmem_cache_create("test_cache", sizeof(struct foo))
> obj = kmem_cache_alloc(cache, GFP_KERNEL);
> kmem_cache_free(cache, obj);
> // print out contents of obj
>
> was not poisoning obj, or setting the redzone fields on obj to "free".
>

Linus recently changed the 2.5 slab allocator to stamp that out.

--- mm/slab.c 18 Sep 2002 03:48:34 -0000 1.28
+++ mm/slab.c 20 Sep 2002 16:22:53 -0000 1.29
@@ -1727,8 +1728,13 @@
         return 0;
 }
 
+/*
+ * If slab debugging is enabled, don't batch slabs
+ * on the per-cpu lists by defaults.
+ */
 static void enable_cpucache (kmem_cache_t *cachep)
 {
+#ifndef CONFIG_DEBUG_SLAB
         int err;
         int limit;
 
@@ -1746,6 +1752,7 @@
         if (err)
                 printk(KERN_ERR "enable_cpucache failed for %s, error %d.\n",
                                         cachep->name, -err);
+#endif
 }
 
 static void enable_all_cpucaches (void)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Oct 15 2002 - 22:00:33 EST