diff options
author | Lee Schermerhorn <lee.schermerhorn@hp.com> | 2010-05-26 17:44:58 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-27 12:12:57 -0400 |
commit | e534c7c5f8d6e9fc46f57fab067c7e48d8ceb172 (patch) | |
tree | 90150391bb1222888627ab22276158ffaf905f12 /arch | |
parent | 7281201922a0063fa60804ce39c277fc98142a47 (diff) |
numa: x86_64: use generic percpu var numa_node_id() implementation
x86 arch specific changes to use generic numa_node_id() based on generic
percpu variable infrastructure. Back out x86's custom version of
numa_node_id()
Signed-off-by: Lee Schermerhorn <lee.schermerhorn@hp.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Christoph Lameter <cl@linux-foundation.org>
Cc: Nick Piggin <npiggin@suse.de>
Cc: David Rientjes <rientjes@google.com>
Cc: Eric Whitney <eric.whitney@hp.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: <linux-arch@vger.kernel.org>
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/x86/Kconfig | 4 | ||||
-rw-r--r-- | arch/x86/include/asm/topology.h | 22 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/common.c | 6 | ||||
-rw-r--r-- | arch/x86/kernel/setup_percpu.c | 4 | ||||
-rw-r--r-- | arch/x86/mm/numa_64.c | 9 |
5 files changed, 21 insertions, 24 deletions
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 5dc54219e73b..dcb0593b4a66 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -1706,6 +1706,10 @@ config HAVE_ARCH_EARLY_PFN_TO_NID | |||
1706 | def_bool X86_64 | 1706 | def_bool X86_64 |
1707 | depends on NUMA | 1707 | depends on NUMA |
1708 | 1708 | ||
1709 | config USE_PERCPU_NUMA_NODE_ID | ||
1710 | def_bool X86_64 | ||
1711 | depends on NUMA | ||
1712 | |||
1709 | menu "Power management and ACPI options" | 1713 | menu "Power management and ACPI options" |
1710 | 1714 | ||
1711 | config ARCH_HIBERNATION_HEADER | 1715 | config ARCH_HIBERNATION_HEADER |
diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h index a2e629476b0e..21899cc31e52 100644 --- a/arch/x86/include/asm/topology.h +++ b/arch/x86/include/asm/topology.h | |||
@@ -53,33 +53,29 @@ | |||
53 | extern int cpu_to_node_map[]; | 53 | extern int cpu_to_node_map[]; |
54 | 54 | ||
55 | /* Returns the number of the node containing CPU 'cpu' */ | 55 | /* Returns the number of the node containing CPU 'cpu' */ |
56 | static inline int cpu_to_node(int cpu) | 56 | static inline int __cpu_to_node(int cpu) |
57 | { | 57 | { |
58 | return cpu_to_node_map[cpu]; | 58 | return cpu_to_node_map[cpu]; |
59 | } | 59 | } |
60 | #define early_cpu_to_node(cpu) cpu_to_node(cpu) | 60 | #define early_cpu_to_node __cpu_to_node |
61 | #define cpu_to_node __cpu_to_node | ||
61 | 62 | ||
62 | #else /* CONFIG_X86_64 */ | 63 | #else /* CONFIG_X86_64 */ |
63 | 64 | ||
64 | /* Mappings between logical cpu number and node number */ | 65 | /* Mappings between logical cpu number and node number */ |
65 | DECLARE_EARLY_PER_CPU(int, x86_cpu_to_node_map); | 66 | DECLARE_EARLY_PER_CPU(int, x86_cpu_to_node_map); |
66 | 67 | ||
67 | /* Returns the number of the current Node. */ | ||
68 | DECLARE_PER_CPU(int, node_number); | ||
69 | #define numa_node_id() percpu_read(node_number) | ||
70 | |||
71 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS | 68 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS |
72 | extern int cpu_to_node(int cpu); | 69 | /* |
70 | * override generic percpu implementation of cpu_to_node | ||
71 | */ | ||
72 | extern int __cpu_to_node(int cpu); | ||
73 | #define cpu_to_node __cpu_to_node | ||
74 | |||
73 | extern int early_cpu_to_node(int cpu); | 75 | extern int early_cpu_to_node(int cpu); |
74 | 76 | ||
75 | #else /* !CONFIG_DEBUG_PER_CPU_MAPS */ | 77 | #else /* !CONFIG_DEBUG_PER_CPU_MAPS */ |
76 | 78 | ||
77 | /* Returns the number of the node containing CPU 'cpu' */ | ||
78 | static inline int cpu_to_node(int cpu) | ||
79 | { | ||
80 | return per_cpu(x86_cpu_to_node_map, cpu); | ||
81 | } | ||
82 | |||
83 | /* Same function but used if called before per_cpu areas are setup */ | 79 | /* Same function but used if called before per_cpu areas are setup */ |
84 | static inline int early_cpu_to_node(int cpu) | 80 | static inline int early_cpu_to_node(int cpu) |
85 | { | 81 | { |
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index cc83a002786e..68e4a6f2211e 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -1121,9 +1121,9 @@ void __cpuinit cpu_init(void) | |||
1121 | oist = &per_cpu(orig_ist, cpu); | 1121 | oist = &per_cpu(orig_ist, cpu); |
1122 | 1122 | ||
1123 | #ifdef CONFIG_NUMA | 1123 | #ifdef CONFIG_NUMA |
1124 | if (cpu != 0 && percpu_read(node_number) == 0 && | 1124 | if (cpu != 0 && percpu_read(numa_node) == 0 && |
1125 | cpu_to_node(cpu) != NUMA_NO_NODE) | 1125 | early_cpu_to_node(cpu) != NUMA_NO_NODE) |
1126 | percpu_write(node_number, cpu_to_node(cpu)); | 1126 | set_numa_node(early_cpu_to_node(cpu)); |
1127 | #endif | 1127 | #endif |
1128 | 1128 | ||
1129 | me = current; | 1129 | me = current; |
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c index ef6370b00e70..a867940a6dfc 100644 --- a/arch/x86/kernel/setup_percpu.c +++ b/arch/x86/kernel/setup_percpu.c | |||
@@ -265,10 +265,10 @@ void __init setup_per_cpu_areas(void) | |||
265 | 265 | ||
266 | #if defined(CONFIG_X86_64) && defined(CONFIG_NUMA) | 266 | #if defined(CONFIG_X86_64) && defined(CONFIG_NUMA) |
267 | /* | 267 | /* |
268 | * make sure boot cpu node_number is right, when boot cpu is on the | 268 | * make sure boot cpu numa_node is right, when boot cpu is on the |
269 | * node that doesn't have mem installed | 269 | * node that doesn't have mem installed |
270 | */ | 270 | */ |
271 | per_cpu(node_number, boot_cpu_id) = cpu_to_node(boot_cpu_id); | 271 | set_cpu_numa_node(boot_cpu_id, early_cpu_to_node(boot_cpu_id)); |
272 | #endif | 272 | #endif |
273 | 273 | ||
274 | /* Setup node to cpumask map */ | 274 | /* Setup node to cpumask map */ |
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c index 8948f47fde05..a7bcc23ef96c 100644 --- a/arch/x86/mm/numa_64.c +++ b/arch/x86/mm/numa_64.c | |||
@@ -33,9 +33,6 @@ int numa_off __initdata; | |||
33 | static unsigned long __initdata nodemap_addr; | 33 | static unsigned long __initdata nodemap_addr; |
34 | static unsigned long __initdata nodemap_size; | 34 | static unsigned long __initdata nodemap_size; |
35 | 35 | ||
36 | DEFINE_PER_CPU(int, node_number) = 0; | ||
37 | EXPORT_PER_CPU_SYMBOL(node_number); | ||
38 | |||
39 | /* | 36 | /* |
40 | * Map cpu index to node index | 37 | * Map cpu index to node index |
41 | */ | 38 | */ |
@@ -809,7 +806,7 @@ void __cpuinit numa_set_node(int cpu, int node) | |||
809 | per_cpu(x86_cpu_to_node_map, cpu) = node; | 806 | per_cpu(x86_cpu_to_node_map, cpu) = node; |
810 | 807 | ||
811 | if (node != NUMA_NO_NODE) | 808 | if (node != NUMA_NO_NODE) |
812 | per_cpu(node_number, cpu) = node; | 809 | set_cpu_numa_node(cpu, node); |
813 | } | 810 | } |
814 | 811 | ||
815 | void __cpuinit numa_clear_node(int cpu) | 812 | void __cpuinit numa_clear_node(int cpu) |
@@ -867,7 +864,7 @@ void __cpuinit numa_remove_cpu(int cpu) | |||
867 | numa_set_cpumask(cpu, 0); | 864 | numa_set_cpumask(cpu, 0); |
868 | } | 865 | } |
869 | 866 | ||
870 | int cpu_to_node(int cpu) | 867 | int __cpu_to_node(int cpu) |
871 | { | 868 | { |
872 | if (early_per_cpu_ptr(x86_cpu_to_node_map)) { | 869 | if (early_per_cpu_ptr(x86_cpu_to_node_map)) { |
873 | printk(KERN_WARNING | 870 | printk(KERN_WARNING |
@@ -877,7 +874,7 @@ int cpu_to_node(int cpu) | |||
877 | } | 874 | } |
878 | return per_cpu(x86_cpu_to_node_map, cpu); | 875 | return per_cpu(x86_cpu_to_node_map, cpu); |
879 | } | 876 | } |
880 | EXPORT_SYMBOL(cpu_to_node); | 877 | EXPORT_SYMBOL(__cpu_to_node); |
881 | 878 | ||
882 | /* | 879 | /* |
883 | * Same function as cpu_to_node() but used if called before the | 880 | * Same function as cpu_to_node() but used if called before the |