aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorChristoph Lameter <clameter@sgi.com>2008-02-14 17:21:32 -0500
committerChristoph Lameter <christoph@stapp.engr.sgi.com>2008-02-14 18:30:01 -0500
commitb7a49f0d4c34166ae84089d9f145cfaae1b0eec5 (patch)
tree716bd20c8b920511f032a42be78c0a523a17565d /mm
parentdada123d99c241d1a45798a7c77bcf99c4968704 (diff)
slub: Determine gfpflags once and not every time a slab is allocated
Currently we determine the gfp flags to pass to the page allocator each time a slab is being allocated. Determine the bits to be set at the time the slab is created. Store in a new allocflags field and add the flags in allocate_slab(). Acked-by: Mel Gorman <mel@csn.ul.ie> Reviewed-by: Pekka Enberg <penberg@cs.helsinki.fi> Signed-off-by: Christoph Lameter <clameter@sgi.com>
Diffstat (limited to 'mm')
-rw-r--r--mm/slub.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/mm/slub.c b/mm/slub.c
index 1af7f2f19420..ccfd41141b6b 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1078,14 +1078,7 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
1078 struct page *page; 1078 struct page *page;
1079 int pages = 1 << s->order; 1079 int pages = 1 << s->order;
1080 1080
1081 if (s->order) 1081 flags |= s->allocflags;
1082 flags |= __GFP_COMP;
1083
1084 if (s->flags & SLAB_CACHE_DMA)
1085 flags |= SLUB_DMA;
1086
1087 if (s->flags & SLAB_RECLAIM_ACCOUNT)
1088 flags |= __GFP_RECLAIMABLE;
1089 1082
1090 if (node == -1) 1083 if (node == -1)
1091 page = alloc_pages(flags, s->order); 1084 page = alloc_pages(flags, s->order);
@@ -2333,6 +2326,16 @@ static int calculate_sizes(struct kmem_cache *s)
2333 if (s->order < 0) 2326 if (s->order < 0)
2334 return 0; 2327 return 0;
2335 2328
2329 s->allocflags = 0;
2330 if (s->order)
2331 s->allocflags |= __GFP_COMP;
2332
2333 if (s->flags & SLAB_CACHE_DMA)
2334 s->allocflags |= SLUB_DMA;
2335
2336 if (s->flags & SLAB_RECLAIM_ACCOUNT)
2337 s->allocflags |= __GFP_RECLAIMABLE;
2338
2336 /* 2339 /*
2337 * Determine the number of objects per slab 2340 * Determine the number of objects per slab
2338 */ 2341 */