diff options
Diffstat (limited to 'mm')
-rw-r--r-- | mm/slab.c | 17 |
1 files changed, 11 insertions, 6 deletions
@@ -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 |