diff options
author | Mel Gorman <mel@csn.ul.ie> | 2009-06-16 18:31:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-16 22:47:32 -0400 |
commit | 6484eb3e2a81807722c5f28efef94d8338b7b996 (patch) | |
tree | 10ce36f412c2ff0c7eb399af1a189f8e354f56db /include/linux/gfp.h | |
parent | b3c466ce512923298ae8c0121d3e9f397a3f1210 (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 'include/linux/gfp.h')
-rw-r--r-- | include/linux/gfp.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/gfp.h b/include/linux/gfp.h index c2d3fe03b5d2..4efa33088a82 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/stddef.h> | 5 | #include <linux/stddef.h> |
6 | #include <linux/linkage.h> | 6 | #include <linux/linkage.h> |
7 | #include <linux/topology.h> | 7 | #include <linux/topology.h> |
8 | #include <linux/mmdebug.h> | ||
8 | 9 | ||
9 | struct vm_area_struct; | 10 | struct vm_area_struct; |
10 | 11 | ||
@@ -192,6 +193,14 @@ static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask, | |||
192 | return __alloc_pages(gfp_mask, order, node_zonelist(nid, gfp_mask)); | 193 | return __alloc_pages(gfp_mask, order, node_zonelist(nid, gfp_mask)); |
193 | } | 194 | } |
194 | 195 | ||
196 | static inline struct page *alloc_pages_exact_node(int nid, gfp_t gfp_mask, | ||
197 | unsigned int order) | ||
198 | { | ||
199 | VM_BUG_ON(nid < 0 || nid >= MAX_NUMNODES); | ||
200 | |||
201 | return __alloc_pages(gfp_mask, order, node_zonelist(nid, gfp_mask)); | ||
202 | } | ||
203 | |||
195 | #ifdef CONFIG_NUMA | 204 | #ifdef CONFIG_NUMA |
196 | extern struct page *alloc_pages_current(gfp_t gfp_mask, unsigned order); | 205 | extern struct page *alloc_pages_current(gfp_t gfp_mask, unsigned order); |
197 | 206 | ||