aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2011-02-16 11:11:10 -0500
committerTejun Heo <tj@kernel.org>2011-02-16 11:11:10 -0500
commitd9c515eacb3bde73f7a5ecb7e35ea6e660ad421d (patch)
tree2f0204314073c8e1c2a83269faa166dd57c99516 /arch/x86/mm
parentac7136b611ee8f8bd6231ce2e1dbdd31ae3d39bc (diff)
x86-64, NUMA: Trivial changes to prepare for emulation updates
* Separate out numa_add_memblk_to() from numa_add_memblk() so that different numa_meminfo can be used. * Rename cmdline to emu_cmdline. * Drop @start/last_pfn from numa_emulation() and use max_pfn directly. This patch doesn't introduce any behavior change. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Yinghai Lu <yinghai@kernel.org> Cc: Brian Gerst <brgerst@gmail.com> Cc: Cyrill Gorcunov <gorcunov@gmail.com> Cc: Shaohui Zheng <shaohui.zheng@intel.com> Cc: David Rientjes <rientjes@google.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86/mm')
-rw-r--r--arch/x86/mm/numa_64.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c
index a3621f2953d..20e2cfe5ab8 100644
--- a/arch/x86/mm/numa_64.c
+++ b/arch/x86/mm/numa_64.c
@@ -193,10 +193,9 @@ static void * __init early_node_mem(int nodeid, unsigned long start,
193 return NULL; 193 return NULL;
194} 194}
195 195
196int __init numa_add_memblk(int nid, u64 start, u64 end) 196static int __init numa_add_memblk_to(int nid, u64 start, u64 end,
197 struct numa_meminfo *mi)
197{ 198{
198 struct numa_meminfo *mi = &numa_meminfo;
199
200 /* ignore zero length blks */ 199 /* ignore zero length blks */
201 if (start == end) 200 if (start == end)
202 return 0; 201 return 0;
@@ -227,6 +226,11 @@ static void __init numa_remove_memblk_from(int idx, struct numa_meminfo *mi)
227 (mi->nr_blks - idx) * sizeof(mi->blk[0])); 226 (mi->nr_blks - idx) * sizeof(mi->blk[0]));
228} 227}
229 228
229int __init numa_add_memblk(int nid, u64 start, u64 end)
230{
231 return numa_add_memblk_to(nid, start, end, &numa_meminfo);
232}
233
230/* Initialize bootmem allocator for a node */ 234/* Initialize bootmem allocator for a node */
231void __init 235void __init
232setup_node_bootmem(int nodeid, unsigned long start, unsigned long end) 236setup_node_bootmem(int nodeid, unsigned long start, unsigned long end)
@@ -539,11 +543,11 @@ static int __init numa_register_memblks(struct numa_meminfo *mi)
539/* Numa emulation */ 543/* Numa emulation */
540static struct bootnode nodes[MAX_NUMNODES] __initdata; 544static struct bootnode nodes[MAX_NUMNODES] __initdata;
541static struct bootnode physnodes[MAX_NUMNODES] __cpuinitdata; 545static struct bootnode physnodes[MAX_NUMNODES] __cpuinitdata;
542static char *cmdline __initdata; 546static char *emu_cmdline __initdata;
543 547
544void __init numa_emu_cmdline(char *str) 548void __init numa_emu_cmdline(char *str)
545{ 549{
546 cmdline = str; 550 emu_cmdline = str;
547} 551}
548 552
549int __init find_node_by_addr(unsigned long addr) 553int __init find_node_by_addr(unsigned long addr)
@@ -861,12 +865,10 @@ static int __init split_nodes_size_interleave(u64 addr, u64 max_addr, u64 size)
861 * Sets up the system RAM area from start_pfn to last_pfn according to the 865 * Sets up the system RAM area from start_pfn to last_pfn according to the
862 * numa=fake command-line option. 866 * numa=fake command-line option.
863 */ 867 */
864static int __init numa_emulation(unsigned long start_pfn, 868static int __init numa_emulation(int acpi, int amd)
865 unsigned long last_pfn, int acpi, int amd)
866{ 869{
867 static struct numa_meminfo ei __initdata; 870 static struct numa_meminfo ei __initdata;
868 u64 addr = start_pfn << PAGE_SHIFT; 871 const u64 max_addr = max_pfn << PAGE_SHIFT;
869 u64 max_addr = last_pfn << PAGE_SHIFT;
870 int num_nodes; 872 int num_nodes;
871 int i; 873 int i;
872 874
@@ -875,16 +877,16 @@ static int __init numa_emulation(unsigned long start_pfn,
875 * the fixed node size. Otherwise, if it is just a single number N, 877 * the fixed node size. Otherwise, if it is just a single number N,
876 * split the system RAM into N fake nodes. 878 * split the system RAM into N fake nodes.
877 */ 879 */
878 if (strchr(cmdline, 'M') || strchr(cmdline, 'G')) { 880 if (strchr(emu_cmdline, 'M') || strchr(emu_cmdline, 'G')) {
879 u64 size; 881 u64 size;
880 882
881 size = memparse(cmdline, &cmdline); 883 size = memparse(emu_cmdline, &emu_cmdline);
882 num_nodes = split_nodes_size_interleave(addr, max_addr, size); 884 num_nodes = split_nodes_size_interleave(0, max_addr, size);
883 } else { 885 } else {
884 unsigned long n; 886 unsigned long n;
885 887
886 n = simple_strtoul(cmdline, NULL, 0); 888 n = simple_strtoul(emu_cmdline, NULL, 0);
887 num_nodes = split_nodes_interleave(addr, max_addr, n); 889 num_nodes = split_nodes_interleave(0, max_addr, n);
888 } 890 }
889 891
890 if (num_nodes < 0) 892 if (num_nodes < 0)
@@ -916,7 +918,7 @@ static int __init numa_emulation(unsigned long start_pfn,
916 init_memory_mapping_high(); 918 init_memory_mapping_high();
917 for_each_node_mask(i, node_possible_map) 919 for_each_node_mask(i, node_possible_map)
918 setup_node_bootmem(i, nodes[i].start, nodes[i].end); 920 setup_node_bootmem(i, nodes[i].start, nodes[i].end);
919 setup_physnodes(addr, max_addr); 921 setup_physnodes(0, max_addr);
920 fake_physnodes(acpi, amd, num_nodes); 922 fake_physnodes(acpi, amd, num_nodes);
921 numa_init_array(); 923 numa_init_array();
922 numa_emu_dist = true; 924 numa_emu_dist = true;
@@ -972,7 +974,7 @@ void __init initmem_init(void)
972 continue; 974 continue;
973#ifdef CONFIG_NUMA_EMU 975#ifdef CONFIG_NUMA_EMU
974 setup_physnodes(0, max_pfn << PAGE_SHIFT); 976 setup_physnodes(0, max_pfn << PAGE_SHIFT);
975 if (cmdline && !numa_emulation(0, max_pfn, i == 0, i == 1)) 977 if (emu_cmdline && !numa_emulation(i == 0, i == 1))
976 return; 978 return;
977 setup_physnodes(0, max_pfn << PAGE_SHIFT); 979 setup_physnodes(0, max_pfn << PAGE_SHIFT);
978 nodes_clear(node_possible_map); 980 nodes_clear(node_possible_map);