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 /arch | |
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 'arch')
-rw-r--r-- | arch/ia64/hp/common/sba_iommu.c | 2 | ||||
-rw-r--r-- | arch/ia64/kernel/mca.c | 3 | ||||
-rw-r--r-- | arch/ia64/kernel/uncached.c | 3 | ||||
-rw-r--r-- | arch/ia64/sn/pci/pci_dma.c | 3 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/ras.c | 4 | ||||
-rw-r--r-- | arch/x86/kvm/vmx.c | 2 |
6 files changed, 9 insertions, 8 deletions
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c index 56ceb68eb99d..fe63b2dc9d07 100644 --- a/arch/ia64/hp/common/sba_iommu.c +++ b/arch/ia64/hp/common/sba_iommu.c | |||
@@ -1131,7 +1131,7 @@ sba_alloc_coherent (struct device *dev, size_t size, dma_addr_t *dma_handle, gfp | |||
1131 | #ifdef CONFIG_NUMA | 1131 | #ifdef CONFIG_NUMA |
1132 | { | 1132 | { |
1133 | struct page *page; | 1133 | struct page *page; |
1134 | page = alloc_pages_node(ioc->node == MAX_NUMNODES ? | 1134 | page = alloc_pages_exact_node(ioc->node == MAX_NUMNODES ? |
1135 | numa_node_id() : ioc->node, flags, | 1135 | numa_node_id() : ioc->node, flags, |
1136 | get_order(size)); | 1136 | get_order(size)); |
1137 | 1137 | ||
diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c index 8f33a8840422..5b17bd402275 100644 --- a/arch/ia64/kernel/mca.c +++ b/arch/ia64/kernel/mca.c | |||
@@ -1829,8 +1829,7 @@ ia64_mca_cpu_init(void *cpu_data) | |||
1829 | data = mca_bootmem(); | 1829 | data = mca_bootmem(); |
1830 | first_time = 0; | 1830 | first_time = 0; |
1831 | } else | 1831 | } else |
1832 | data = page_address(alloc_pages_node(numa_node_id(), | 1832 | data = __get_free_pages(GFP_KERNEL, get_order(sz)); |
1833 | GFP_KERNEL, get_order(sz))); | ||
1834 | if (!data) | 1833 | if (!data) |
1835 | panic("Could not allocate MCA memory for cpu %d\n", | 1834 | panic("Could not allocate MCA memory for cpu %d\n", |
1836 | cpu); | 1835 | cpu); |
diff --git a/arch/ia64/kernel/uncached.c b/arch/ia64/kernel/uncached.c index 8eff8c1d40a6..6ba72ab42fcc 100644 --- a/arch/ia64/kernel/uncached.c +++ b/arch/ia64/kernel/uncached.c | |||
@@ -98,7 +98,8 @@ static int uncached_add_chunk(struct uncached_pool *uc_pool, int nid) | |||
98 | 98 | ||
99 | /* attempt to allocate a granule's worth of cached memory pages */ | 99 | /* attempt to allocate a granule's worth of cached memory pages */ |
100 | 100 | ||
101 | page = alloc_pages_node(nid, GFP_KERNEL | __GFP_ZERO | GFP_THISNODE, | 101 | page = alloc_pages_exact_node(nid, |
102 | GFP_KERNEL | __GFP_ZERO | GFP_THISNODE, | ||
102 | IA64_GRANULE_SHIFT-PAGE_SHIFT); | 103 | IA64_GRANULE_SHIFT-PAGE_SHIFT); |
103 | if (!page) { | 104 | if (!page) { |
104 | mutex_unlock(&uc_pool->add_chunk_mutex); | 105 | mutex_unlock(&uc_pool->add_chunk_mutex); |
diff --git a/arch/ia64/sn/pci/pci_dma.c b/arch/ia64/sn/pci/pci_dma.c index d876423e4e75..98b684928e12 100644 --- a/arch/ia64/sn/pci/pci_dma.c +++ b/arch/ia64/sn/pci/pci_dma.c | |||
@@ -90,7 +90,8 @@ static void *sn_dma_alloc_coherent(struct device *dev, size_t size, | |||
90 | */ | 90 | */ |
91 | node = pcibus_to_node(pdev->bus); | 91 | node = pcibus_to_node(pdev->bus); |
92 | if (likely(node >=0)) { | 92 | if (likely(node >=0)) { |
93 | struct page *p = alloc_pages_node(node, flags, get_order(size)); | 93 | struct page *p = alloc_pages_exact_node(node, |
94 | flags, get_order(size)); | ||
94 | 95 | ||
95 | if (likely(p)) | 96 | if (likely(p)) |
96 | cpuaddr = page_address(p); | 97 | cpuaddr = page_address(p); |
diff --git a/arch/powerpc/platforms/cell/ras.c b/arch/powerpc/platforms/cell/ras.c index 296b5268754e..5e0a191764fc 100644 --- a/arch/powerpc/platforms/cell/ras.c +++ b/arch/powerpc/platforms/cell/ras.c | |||
@@ -122,8 +122,8 @@ static int __init cbe_ptcal_enable_on_node(int nid, int order) | |||
122 | 122 | ||
123 | area->nid = nid; | 123 | area->nid = nid; |
124 | area->order = order; | 124 | area->order = order; |
125 | area->pages = alloc_pages_node(area->nid, GFP_KERNEL | GFP_THISNODE, | 125 | area->pages = alloc_pages_exact_node(area->nid, GFP_KERNEL|GFP_THISNODE, |
126 | area->order); | 126 | area->order); |
127 | 127 | ||
128 | if (!area->pages) { | 128 | if (!area->pages) { |
129 | printk(KERN_WARNING "%s: no page on node %d\n", | 129 | printk(KERN_WARNING "%s: no page on node %d\n", |
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 32d6ae8fb60e..e770bf349ec4 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -1277,7 +1277,7 @@ static struct vmcs *alloc_vmcs_cpu(int cpu) | |||
1277 | struct page *pages; | 1277 | struct page *pages; |
1278 | struct vmcs *vmcs; | 1278 | struct vmcs *vmcs; |
1279 | 1279 | ||
1280 | pages = alloc_pages_node(node, GFP_KERNEL, vmcs_config.order); | 1280 | pages = alloc_pages_exact_node(node, GFP_KERNEL, vmcs_config.order); |
1281 | if (!pages) | 1281 | if (!pages) |
1282 | return NULL; | 1282 | return NULL; |
1283 | vmcs = page_address(pages); | 1283 | vmcs = page_address(pages); |