From 834beda15ecc43c110c0a6ac39ec1aa79f891716 Mon Sep 17 00:00:00 2001 From: "travis@sgi.com" Date: Wed, 30 Jan 2008 13:33:21 +0100 Subject: x86: change NR_CPUS arrays in numa_64 fixup Change the following static arrays sized by NR_CPUS to per_cpu data variables: char cpu_to_node_map[NR_CPUS]; fixup: - Split cpu_to_node function into "early" and "late" versions so that x86_cpu_to_node_map_early_ptr is not EXPORT'ed and the cpu_to_node inline function is more streamlined. - This also involves setting up the percpu maps as early as possible. - Fix X86_32 NUMA build errors that previous version of this patch caused. V2->V3: - add early_cpu_to_node function to keep cpu_to_node efficient - move and rename smp_set_apicids() to setup_percpu_maps() - call setup_percpu_maps() as early as possible V1->V2: - Removed extraneous casts - Fix !NUMA builds with '#ifdef CONFIG_NUMA" Signed-off-by: Mike Travis Reviewed-by: Christoph Lameter Signed-off-by: Ingo Molnar Signed-off-by: Thomas Gleixner --- include/asm-x86/topology.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'include/asm-x86') diff --git a/include/asm-x86/topology.h b/include/asm-x86/topology.h index 2da1464..040374f 100644 --- a/include/asm-x86/topology.h +++ b/include/asm-x86/topology.h @@ -30,16 +30,30 @@ #include /* Mappings between logical cpu number and node number */ +#ifdef CONFIG_X86_32 +extern u8 cpu_to_node_map[]; + +#else DECLARE_PER_CPU(u16, x86_cpu_to_node_map); extern u16 x86_cpu_to_node_map_init[]; extern void *x86_cpu_to_node_map_early_ptr; +#endif + extern cpumask_t node_to_cpumask_map[]; #define NUMA_NO_NODE ((u16)(~0)) /* Returns the number of the node containing CPU 'cpu' */ +#ifdef CONFIG_X86_32 +#define early_cpu_to_node(cpu) cpu_to_node(cpu) static inline int cpu_to_node(int cpu) { + return cpu_to_node_map[cpu]; +} + +#else /* CONFIG_X86_64 */ +static inline int early_cpu_to_node(int cpu) +{ u16 *cpu_to_node_map = x86_cpu_to_node_map_early_ptr; if (cpu_to_node_map) @@ -50,6 +64,15 @@ static inline int cpu_to_node(int cpu) return NUMA_NO_NODE; } +static inline int cpu_to_node(int cpu) +{ + if(per_cpu_offset(cpu)) + return per_cpu(x86_cpu_to_node_map, cpu); + else + return NUMA_NO_NODE; +} +#endif /* CONFIG_X86_64 */ + /* * Returns the number of the node containing Node 'node'. This * architecture is flat, so it is a pretty simple function! -- cgit v1.1