[PATCH] slab: fix the debug information with different alignments.

From: Giuseppe Cavallaro
Date: Fri Feb 13 2009 - 09:06:22 EST


This patch is to fix the debug information reported in /proc/slab_allocators

for all the architectures by using a new define (ARCH_SLAB_MAX_DEBUG_ALIGN)
rather than the alignment of a 64-bit integer.
Currently, on sh, for example, /proc/slab_allocators has no size-X entries
as side effect.

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@xxxxxx>
---
mm/slab.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/mm/slab.c b/mm/slab.c
index 4d00855..587e0f3 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -165,6 +165,10 @@
#define ARCH_SLAB_MINALIGN 0
#endif

+#ifndef ARCH_SLAB_MAX_DEBUG_ALIGN
+#define ARCH_SLAB_MAX_DEBUG_ALIGN __alignof__(unsigned long long)
+#endif
+
#ifndef ARCH_KMALLOC_FLAGS
#define ARCH_KMALLOC_FLAGS SLAB_HWCACHE_ALIGN
#endif
@@ -2262,7 +2266,7 @@ kmem_cache_create (const char *name, size_t size, size_t align,
ralign = align;
}
/* disable debug if necessary */
- if (ralign > __alignof__(unsigned long long))
+ if (ralign > ARCH_SLAB_MAX_DEBUG_ALIGN)
flags &= ~(SLAB_RED_ZONE | SLAB_STORE_USER);
/*
* 4) Store it.
--
1.5.6.6


--------------030203020209040702050708
Content-Type: text/plain;
name="0002-sh-add-the-default-value-for-ARCH_SLAB_MAX_DEBUG_AL.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename*0="0002-sh-add-the-default-value-for-ARCH_SLAB_MAX_DEBUG_AL.pat";
filename*1="ch"