aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/include/asm/pda.h1
-rw-r--r--arch/x86/include/asm/topology.h3
-rw-r--r--arch/x86/kernel/cpu/common.c13
-rw-r--r--arch/x86/kernel/setup_percpu.c4
4 files changed, 11 insertions, 10 deletions
diff --git a/arch/x86/include/asm/pda.h b/arch/x86/include/asm/pda.h
index 4527d70314d4..b30ef6bddc43 100644
--- a/arch/x86/include/asm/pda.h
+++ b/arch/x86/include/asm/pda.h
@@ -22,7 +22,6 @@ struct x8664_pda {
22 /* gcc-ABI: this canary MUST be at 22 /* gcc-ABI: this canary MUST be at
23 offset 40!!! */ 23 offset 40!!! */
24#endif 24#endif
25 short nodenumber; /* number of current node (32k max) */
26 short in_bootmem; /* pda lives in bootmem */ 25 short in_bootmem; /* pda lives in bootmem */
27 short isidle; 26 short isidle;
28} ____cacheline_aligned_in_smp; 27} ____cacheline_aligned_in_smp;
diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
index 87ca3fd86e88..ffea1fe03a99 100644
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -83,7 +83,8 @@ extern cpumask_t *node_to_cpumask_map;
83DECLARE_EARLY_PER_CPU(int, x86_cpu_to_node_map); 83DECLARE_EARLY_PER_CPU(int, x86_cpu_to_node_map);
84 84
85/* Returns the number of the current Node. */ 85/* Returns the number of the current Node. */
86#define numa_node_id() read_pda(nodenumber) 86DECLARE_PER_CPU(int, node_number);
87#define numa_node_id() percpu_read(node_number)
87 88
88#ifdef CONFIG_DEBUG_PER_CPU_MAPS 89#ifdef CONFIG_DEBUG_PER_CPU_MAPS
89extern int cpu_to_node(int cpu); 90extern int cpu_to_node(int cpu);
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index e2323ecce1d3..7976a6a0f65c 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -897,18 +897,11 @@ DEFINE_PER_CPU(unsigned int, irq_count) = -1;
897 897
898void __cpuinit pda_init(int cpu) 898void __cpuinit pda_init(int cpu)
899{ 899{
900 struct x8664_pda *pda = cpu_pda(cpu);
901
902 /* Setup up data that may be needed in __get_free_pages early */ 900 /* Setup up data that may be needed in __get_free_pages early */
903 loadsegment(fs, 0); 901 loadsegment(fs, 0);
904 loadsegment(gs, 0); 902 loadsegment(gs, 0);
905 903
906 load_pda_offset(cpu); 904 load_pda_offset(cpu);
907
908 if (cpu != 0) {
909 if (pda->nodenumber == 0 && cpu_to_node(cpu) != NUMA_NO_NODE)
910 pda->nodenumber = cpu_to_node(cpu);
911 }
912} 905}
913 906
914static DEFINE_PER_CPU_PAGE_ALIGNED(char, exception_stacks 907static DEFINE_PER_CPU_PAGE_ALIGNED(char, exception_stacks
@@ -978,6 +971,12 @@ void __cpuinit cpu_init(void)
978 if (cpu != 0) 971 if (cpu != 0)
979 pda_init(cpu); 972 pda_init(cpu);
980 973
974#ifdef CONFIG_NUMA
975 if (cpu != 0 && percpu_read(node_number) == 0 &&
976 cpu_to_node(cpu) != NUMA_NO_NODE)
977 percpu_write(node_number, cpu_to_node(cpu));
978#endif
979
981 me = current; 980 me = current;
982 981
983 if (cpumask_test_and_set_cpu(cpu, cpu_initialized_mask)) 982 if (cpumask_test_and_set_cpu(cpu, cpu_initialized_mask))
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c
index 258497f93f4d..efbafbbff584 100644
--- a/arch/x86/kernel/setup_percpu.c
+++ b/arch/x86/kernel/setup_percpu.c
@@ -53,6 +53,8 @@ EXPORT_EARLY_PER_CPU_SYMBOL(x86_bios_cpu_apicid);
53 53
54#if defined(CONFIG_NUMA) && defined(CONFIG_X86_64) 54#if defined(CONFIG_NUMA) && defined(CONFIG_X86_64)
55#define X86_64_NUMA 1 /* (used later) */ 55#define X86_64_NUMA 1 /* (used later) */
56DEFINE_PER_CPU(int, node_number) = 0;
57EXPORT_PER_CPU_SYMBOL(node_number);
56 58
57/* 59/*
58 * Map cpu index to node index 60 * Map cpu index to node index
@@ -283,7 +285,7 @@ void __cpuinit numa_set_node(int cpu, int node)
283 per_cpu(x86_cpu_to_node_map, cpu) = node; 285 per_cpu(x86_cpu_to_node_map, cpu) = node;
284 286
285 if (node != NUMA_NO_NODE) 287 if (node != NUMA_NO_NODE)
286 cpu_pda(cpu)->nodenumber = node; 288 per_cpu(node_number, cpu) = node;
287} 289}
288 290
289void __cpuinit numa_clear_node(int cpu) 291void __cpuinit numa_clear_node(int cpu)