--- mm/slub.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) Index: slub/mm/slub.c =================================================================== --- slub.orig/mm/slub.c 2007-05-25 17:54:23.000000000 -0700 +++ slub/mm/slub.c 2007-05-25 17:55:06.000000000 -0700 @@ -199,7 +199,7 @@ static inline void ClearSlabDebug(struct * Set of flags that will prevent slab merging */ #define SLUB_NEVER_MERGE (SLAB_RED_ZONE | SLAB_POISON | SLAB_STORE_USER | \ - SLAB_TRACE | SLAB_DESTROY_BY_RCU) + SLAB_TRACE | SLAB_DESTROY_BY_RCU | __NOMERGE) #define SLUB_MERGE_SAME (SLAB_DEBUG_FREE | SLAB_RECLAIM_ACCOUNT | \ SLAB_CACHE_DMA) @@ -214,6 +214,7 @@ static inline void ClearSlabDebug(struct /* Internal SLUB flags */ #define __OBJECT_POISON 0x80000000 /* Poison object */ +#define __NOMERGE 0x40000000 /* Unmergeable cache */ /* Not all arches define cache_line_size */ #ifndef cache_line_size @@ -2197,12 +2198,10 @@ static int __init setup_slub_nomerge(cha __setup("slub_nomerge", setup_slub_nomerge); static struct kmem_cache *create_kmalloc_cache(struct kmem_cache *s, - const char *name, int size, gfp_t gfp_flags) + const char *name, int size, gfp_t gfp_flags, int flags) { - unsigned int flags = 0; - if (gfp_flags & SLUB_DMA) - flags = SLAB_CACHE_DMA; + flags |= SLAB_CACHE_DMA; down_write(&slub_lock); if (!kmem_cache_open(s, gfp_flags, name, size, ARCH_KMALLOC_MINALIGN, @@ -2256,7 +2255,7 @@ static struct kmem_cache *get_slab(size_ text = kasprintf(flags & ~SLUB_DMA, "kmalloc_dma-%d", (unsigned int)realsize); - s = create_kmalloc_cache(x, text, realsize, flags); + s = create_kmalloc_cache(x, text, realsize, flags, 0); kmalloc_caches_dma[index] = s; return s; } @@ -2472,7 +2471,7 @@ void __init kmem_cache_init(void) * kmem_cache_open for slab_state == DOWN. */ create_kmalloc_cache(&kmalloc_caches[0], "kmem_cache_node", - sizeof(struct kmem_cache_node), GFP_KERNEL); + sizeof(struct kmem_cache_node), GFP_KERNEL, __NOMERGE); #endif /* Able to allocate the per node structures */ @@ -2480,13 +2479,13 @@ void __init kmem_cache_init(void) /* Caches that are not of the two-to-the-power-of size */ create_kmalloc_cache(&kmalloc_caches[1], - "kmalloc-96", 96, GFP_KERNEL); + "kmalloc-96", 96, GFP_KERNEL, 0); create_kmalloc_cache(&kmalloc_caches[2], - "kmalloc-192", 192, GFP_KERNEL); + "kmalloc-192", 192, GFP_KERNEL, 0); for (i = KMALLOC_SHIFT_LOW; i <= KMALLOC_SHIFT_HIGH; i++) create_kmalloc_cache(&kmalloc_caches[i], - "kmalloc", 1 << i, GFP_KERNEL); + "kmalloc", 1 << i, GFP_KERNEL, 0); slab_state = UP;