aboutsummaryrefslogtreecommitdiffstats
path: root/mm/slab.c
diff options
context:
space:
mode:
authorKevin Hilman <khilman@mvista.com>2006-12-06 23:32:11 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-07 11:39:21 -0500
commita44b56d354b49f9abb184e5a14f71889856283bb (patch)
tree36eced3b179038a70463645395e6b31f3a5cc74c /mm/slab.c
parentcace673d376d97b0c66ffa0a49b8d588a696d5d2 (diff)
[PATCH] slab debug and ARCH_SLAB_MINALIGN don't get along
When CONFIG_SLAB_DEBUG is used in combination with ARCH_SLAB_MINALIGN, some debug flags should be disabled which depend on BYTES_PER_WORD alignment. The disabling of these debug flags is not properly handled when BYTES_PER_WORD < ARCH_SLAB_MEMALIGN < cache_line_size() This patch fixes that and also adds an alignment check to cache_alloc_debugcheck_after() when ARCH_SLAB_MINALIGN is used. Signed-off-by: Kevin Hilman <khilman@mvista.com> Cc: Pekka Enberg <penberg@cs.helsinki.fi> Cc: Christoph Lameter <clameter@engr.sgi.com> Cc: Manfred Spraul <manfred@colorfullife.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm/slab.c')
-rw-r--r--mm/slab.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/mm/slab.c b/mm/slab.c
index 5de81473df34..ff60a94142f9 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2197,18 +2197,17 @@ kmem_cache_create (const char *name, size_t size, size_t align,
2197 if (flags & SLAB_RED_ZONE || flags & SLAB_STORE_USER) 2197 if (flags & SLAB_RED_ZONE || flags & SLAB_STORE_USER)
2198 ralign = BYTES_PER_WORD; 2198 ralign = BYTES_PER_WORD;
2199 2199
2200 /* 2) arch mandated alignment: disables debug if necessary */ 2200 /* 2) arch mandated alignment */
2201 if (ralign < ARCH_SLAB_MINALIGN) { 2201 if (ralign < ARCH_SLAB_MINALIGN) {
2202 ralign = ARCH_SLAB_MINALIGN; 2202 ralign = ARCH_SLAB_MINALIGN;
2203 if (ralign > BYTES_PER_WORD)
2204 flags &= ~(SLAB_RED_ZONE | SLAB_STORE_USER);
2205 } 2203 }
2206 /* 3) caller mandated alignment: disables debug if necessary */ 2204 /* 3) caller mandated alignment */
2207 if (ralign < align) { 2205 if (ralign < align) {
2208 ralign = align; 2206 ralign = align;
2209 if (ralign > BYTES_PER_WORD)
2210 flags &= ~(SLAB_RED_ZONE | SLAB_STORE_USER);
2211 } 2207 }
2208 /* disable debug if necessary */
2209 if (ralign > BYTES_PER_WORD)
2210 flags &= ~(SLAB_RED_ZONE | SLAB_STORE_USER);
2212 /* 2211 /*
2213 * 4) Store it. 2212 * 4) Store it.
2214 */ 2213 */
@@ -3063,6 +3062,12 @@ static void *cache_alloc_debugcheck_after(struct kmem_cache *cachep,
3063 3062
3064 cachep->ctor(objp, cachep, ctor_flags); 3063 cachep->ctor(objp, cachep, ctor_flags);
3065 } 3064 }
3065#if ARCH_SLAB_MINALIGN
3066 if ((u32)objp & (ARCH_SLAB_MINALIGN-1)) {
3067 printk(KERN_ERR "0x%p: not aligned to ARCH_SLAB_MINALIGN=%d\n",
3068 objp, ARCH_SLAB_MINALIGN);
3069 }
3070#endif
3066 return objp; 3071 return objp;
3067} 3072}
3068#else 3073#else