summaryrefslogtreecommitdiff
path: root/arch/x86/mm/numa_emulation.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2011-03-05 09:32:45 +0300
committerIngo Molnar <mingo@elte.hu>2011-03-05 09:32:45 +0300
commitca764aaf025d2c83054191895b366fa81a9ccf48 (patch)
treee8e3bc880f4b269c924ccdf51ba8d6f3ff33b765 /arch/x86/mm/numa_emulation.c
parentd04c579f971bf7d995db1ef7a7161c0143068859 (diff)
parent078a198906c796981f93ff100c210506e91aade5 (diff)
downloadlinux-ca764aaf025d2c83054191895b366fa81a9ccf48.tar.xz
Merge branch 'x86-mm' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/misc into x86/mm
Diffstat (limited to 'arch/x86/mm/numa_emulation.c')
-rw-r--r--arch/x86/mm/numa_emulation.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/arch/x86/mm/numa_emulation.c b/arch/x86/mm/numa_emulation.c
index aeecea93820f..3696be0c2204 100644
--- a/arch/x86/mm/numa_emulation.c
+++ b/arch/x86/mm/numa_emulation.c
@@ -301,6 +301,7 @@ void __init numa_emulation(struct numa_meminfo *numa_meminfo, int numa_dist_cnt)
const u64 max_addr = max_pfn << PAGE_SHIFT;
u8 *phys_dist = NULL;
size_t phys_size = numa_dist_cnt * numa_dist_cnt * sizeof(phys_dist[0]);
+ int dfl_phys_nid;
int i, j, ret;
if (!emu_cmdline)
@@ -357,6 +358,19 @@ void __init numa_emulation(struct numa_meminfo *numa_meminfo, int numa_dist_cnt)
node_distance(i, j);
}
+ /* determine the default phys nid to use for unmapped nodes */
+ dfl_phys_nid = NUMA_NO_NODE;
+ for (i = 0; i < ARRAY_SIZE(emu_nid_to_phys); i++) {
+ if (emu_nid_to_phys[i] != NUMA_NO_NODE) {
+ dfl_phys_nid = emu_nid_to_phys[i];
+ break;
+ }
+ }
+ if (dfl_phys_nid == NUMA_NO_NODE) {
+ pr_warning("NUMA: Warning: can't determine default physical node, disabling emulation\n");
+ goto no_emu;
+ }
+
/* commit */
*numa_meminfo = ei;
@@ -377,7 +391,7 @@ void __init numa_emulation(struct numa_meminfo *numa_meminfo, int numa_dist_cnt)
/* make sure all emulated nodes are mapped to a physical node */
for (i = 0; i < ARRAY_SIZE(emu_nid_to_phys); i++)
if (emu_nid_to_phys[i] == NUMA_NO_NODE)
- emu_nid_to_phys[i] = 0;
+ emu_nid_to_phys[i] = dfl_phys_nid;
/*
* Transform distance table. numa_set_distance() ignores all
@@ -417,9 +431,7 @@ void __cpuinit numa_add_cpu(int cpu)
{
int physnid, nid;
- nid = numa_cpu_node(cpu);
- if (nid == NUMA_NO_NODE)
- nid = early_cpu_to_node(cpu);
+ nid = early_cpu_to_node(cpu);
BUG_ON(nid == NUMA_NO_NODE || !node_online(nid));
physnid = emu_nid_to_phys[nid];