Re: kernel BUG at mm/slub.c:3689!

From: Haavard Skinnemoen
Date: Tue Jun 12 2007 - 06:17:20 EST


On Tue, 12 Jun 2007 10:55:12 +0200
Haavard Skinnemoen <hskinnemoen@xxxxxxxxx> wrote:

> On Mon, 11 Jun 2007 20:16:31 -0700 (PDT)
> Christoph Lameter <clameter@xxxxxxx> wrote:
>
> > > and I can't do that over VPN. I'll test it first thing in the morning.
> >
> > Here is a more general fix
>
> Sorry, that didn't work either. One problem is that you're using
> ARCH_KMALLOC_MIN_ALIGN instead of ARCH_KMALLOC_MINALIGN in slub_defs.h
> to determine KMALLOC_MIN_SIZE. After fixing that, it fails with
> undefined references to __kmalloc_size_too_large. It looks like ilog2()
> is behaving strangely; I'll see if I can figure out what's going on.

Looks like gcc didn't recognize max(8, ARCH_KMALLOC_MINALIGN) as a
constant expression, so __kmalloc_size_too_large() got referenced
although it never got called as far as I can tell. Works like a charm
after applying this patch on top of yours.

Tested with CONFIG_SLUB_DEBUG=n, CONFIG_SLUB_DEBUG=y and
CONFIG_SLUB_DEBUG=y with slub_debug set.


diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index 7ef94d4..7fb785f 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -56,8 +56,8 @@ struct kmem_cache {
/*
* Kmalloc subsystem.
*/
-#ifdef ARCH_KMALLOC_MIN_ALIGN
-#define KMALLOC_MIN_SIZE max(8, ARCH_KMALLOC_MIN_ALIGN)
+#if defined(ARCH_KMALLOC_MINALIGN) && (ARCH_KMALLOC_MINALIGN > 8)
+#define KMALLOC_MIN_SIZE ARCH_KMALLOC_MINALIGN
#else
#define KMALLOC_MIN_SIZE 8
#endif
-
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/