--- include/linux/slub_def.h | 1 + mm/slub.c | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) Index: linux-2.6/include/linux/slub_def.h =================================================================== --- linux-2.6.orig/include/linux/slub_def.h 2008-01-09 23:53:05.482021298 -0800 +++ linux-2.6/include/linux/slub_def.h 2008-01-09 23:56:38.415737243 -0800 @@ -40,6 +40,7 @@ struct kmem_cache { int objsize; /* The size of an object without meta data */ int offset; /* Free pointer offset. */ int order; + gfp_t allocflags; /* Allocation flags */ /* * Avoid an extra cache line for UP, SMP and for the node local to Index: linux-2.6/mm/slub.c =================================================================== --- linux-2.6.orig/mm/slub.c 2008-01-09 23:53:30.374231253 -0800 +++ linux-2.6/mm/slub.c 2008-01-09 23:56:10.511522745 -0800 @@ -1040,14 +1040,7 @@ static struct page *allocate_slab(struct struct page *page; int pages = 1 << s->order; - if (s->order) - flags |= __GFP_COMP; - - if (s->flags & SLAB_CACHE_DMA) - flags |= SLUB_DMA; - - if (s->flags & SLAB_RECLAIM_ACCOUNT) - flags |= __GFP_RECLAIMABLE; + flags |= s->allocflags; if (node == -1) page = alloc_pages(flags, s->order); @@ -2373,6 +2366,15 @@ static int kmem_cache_open(struct kmem_c if (!calculate_sizes(s)) goto error; + if (s->order) + s->allocflags |= __GFP_COMP; + + if (s->flags & SLAB_CACHE_DMA) + s->allocflags |= SLUB_DMA; + + if (s->flags & SLAB_RECLAIM_ACCOUNT) + s->allocflags |= __GFP_RECLAIMABLE; + s->refcount = 1; #ifdef CONFIG_NUMA s->remote_node_defrag_ratio = 100;