From d23ea0ea829060a15ee7c0fbb5b1c567b9f0d089 Mon Sep 17 00:00:00 2001 From: Christoph Lameter Date: Thu, 14 Feb 2008 14:21:32 -0800 Subject: [PATCH] --- yaml --- r: 85510 b: refs/heads/master c: b7a49f0d4c34166ae84089d9f145cfaae1b0eec5 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/include/linux/slub_def.h | 1 + trunk/mm/slub.c | 19 +++++++++++-------- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/[refs] b/[refs] index f9cf6c7a05d1..c51b37afaab2 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: dada123d99c241d1a45798a7c77bcf99c4968704 +refs/heads/master: b7a49f0d4c34166ae84089d9f145cfaae1b0eec5 diff --git a/trunk/include/linux/slub_def.h b/trunk/include/linux/slub_def.h index a849c472b845..98be113cf935 100644 --- a/trunk/include/linux/slub_def.h +++ b/trunk/include/linux/slub_def.h @@ -71,6 +71,7 @@ struct kmem_cache { /* Allocation and freeing of slabs */ int objects; /* Number of objects in slab */ + gfp_t allocflags; /* gfp flags to use on each alloc */ int refcount; /* Refcount for slab cache destroy */ void (*ctor)(struct kmem_cache *, void *); int inuse; /* Offset to metadata */ diff --git a/trunk/mm/slub.c b/trunk/mm/slub.c index 1af7f2f19420..ccfd41141b6b 100644 --- a/trunk/mm/slub.c +++ b/trunk/mm/slub.c @@ -1078,14 +1078,7 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node) 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); @@ -2333,6 +2326,16 @@ static int calculate_sizes(struct kmem_cache *s) if (s->order < 0) return 0; + s->allocflags = 0; + 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; + /* * Determine the number of objects per slab */