aboutsummaryrefslogtreecommitdiffstats
path: root/mm/slab.c
diff options
context:
space:
mode:
authorMel Gorman <mel@csn.ul.ie>2009-06-16 18:31:54 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-16 22:47:32 -0400
commit6484eb3e2a81807722c5f28efef94d8338b7b996 (patch)
tree10ce36f412c2ff0c7eb399af1a189f8e354f56db /mm/slab.c
parentb3c466ce512923298ae8c0121d3e9f397a3f1210 (diff)
page allocator: do not check NUMA node ID when the caller knows the node is valid
Callers of alloc_pages_node() can optionally specify -1 as a node to mean "allocate from the current node". However, a number of the callers in fast paths know for a fact their node is valid. To avoid a comparison and branch, this patch adds alloc_pages_exact_node() that only checks the nid with VM_BUG_ON(). Callers that know their node is valid are then converted. Signed-off-by: Mel Gorman <mel@csn.ul.ie> Reviewed-by: Christoph Lameter <cl@linux-foundation.org> Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Reviewed-by: Pekka Enberg <penberg@cs.helsinki.fi> Acked-by: Paul Mundt <lethal@linux-sh.org> [for the SLOB NUMA bits] Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Nick Piggin <nickpiggin@yahoo.com.au> Cc: Dave Hansen <dave@linux.vnet.ibm.com> Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/slab.c')
-rw-r--r--mm/slab.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mm/slab.c b/mm/slab.c
index 18e3164de09a..bb3254c95cd2 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1707,7 +1707,7 @@ static void *kmem_getpages(struct kmem_cache *cachep, gfp_t flags, int nodeid)
1707 if (cachep->flags & SLAB_RECLAIM_ACCOUNT) 1707 if (cachep->flags & SLAB_RECLAIM_ACCOUNT)
1708 flags |= __GFP_RECLAIMABLE; 1708 flags |= __GFP_RECLAIMABLE;
1709 1709
1710 page = alloc_pages_node(nodeid, flags, cachep->gfporder); 1710 page = alloc_pages_exact_node(nodeid, flags, cachep->gfporder);
1711 if (!page) 1711 if (!page)
1712 return NULL; 1712 return NULL;
1713 1713
@@ -3261,7 +3261,7 @@ retry:
3261 if (local_flags & __GFP_WAIT) 3261 if (local_flags & __GFP_WAIT)
3262 local_irq_enable(); 3262 local_irq_enable();
3263 kmem_flagcheck(cache, flags); 3263 kmem_flagcheck(cache, flags);
3264 obj = kmem_getpages(cache, local_flags, -1); 3264 obj = kmem_getpages(cache, local_flags, numa_node_id());
3265 if (local_flags & __GFP_WAIT) 3265 if (local_flags & __GFP_WAIT)
3266 local_irq_disable(); 3266 local_irq_disable();
3267 if (obj) { 3267 if (obj) {