aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortravis@sgi.com <travis@sgi.com>2008-01-30 07:33:11 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:33:11 -0500
commitdf3825c56dd70a4d7796041388f3cfe51c1db832 (patch)
tree6110ef6ce26704679b9d13399e2aa368f3430126
parent3b41908902df1dba141cd7de1a727bb03718a654 (diff)
x86: change NR_CPUS arrays in numa_64
Change the following static arrays sized by NR_CPUS to per_cpu data variables: char cpu_to_node_map[NR_CPUS]; Signed-off-by: Mike Travis <travis@sgi.com> Reviewed-by: Christoph Lameter <clameter@sgi.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--arch/x86/kernel/setup_64.c4
-rw-r--r--arch/x86/kernel/smpboot_64.c6
-rw-r--r--arch/x86/mm/numa_64.c20
-rw-r--r--include/asm-x86/numa_64.h2
-rw-r--r--include/asm-x86/topology.h15
-rw-r--r--net/sunrpc/svc.c1
6 files changed, 38 insertions, 10 deletions
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c
index e2beb4cba15..529e45c37b1 100644
--- a/arch/x86/kernel/setup_64.c
+++ b/arch/x86/kernel/setup_64.c
@@ -65,6 +65,7 @@
65#include <asm/cacheflush.h> 65#include <asm/cacheflush.h>
66#include <asm/mce.h> 66#include <asm/mce.h>
67#include <asm/ds.h> 67#include <asm/ds.h>
68#include <asm/topology.h>
68 69
69#ifdef CONFIG_PARAVIRT 70#ifdef CONFIG_PARAVIRT
70#include <asm/paravirt.h> 71#include <asm/paravirt.h>
@@ -359,8 +360,9 @@ void __init setup_arch(char **cmdline_p)
359 io_delay_init(); 360 io_delay_init();
360 361
361#ifdef CONFIG_SMP 362#ifdef CONFIG_SMP
362 /* setup to use the static apicid table during kernel startup */ 363 /* setup to use the early static init tables during kernel startup */
363 x86_cpu_to_apicid_early_ptr = (void *)&x86_cpu_to_apicid_init; 364 x86_cpu_to_apicid_early_ptr = (void *)&x86_cpu_to_apicid_init;
365 x86_cpu_to_node_map_early_ptr = (void *)&x86_cpu_to_node_map_init;
364#endif 366#endif
365 367
366#ifdef CONFIG_ACPI 368#ifdef CONFIG_ACPI
diff --git a/arch/x86/kernel/smpboot_64.c b/arch/x86/kernel/smpboot_64.c
index a2076b5f12a..a8bc2bcdb74 100644
--- a/arch/x86/kernel/smpboot_64.c
+++ b/arch/x86/kernel/smpboot_64.c
@@ -861,9 +861,12 @@ void __init smp_set_apicids(void)
861 int cpu; 861 int cpu;
862 862
863 for_each_possible_cpu(cpu) { 863 for_each_possible_cpu(cpu) {
864 if (per_cpu_offset(cpu)) 864 if (per_cpu_offset(cpu)) {
865 per_cpu(x86_cpu_to_apicid, cpu) = 865 per_cpu(x86_cpu_to_apicid, cpu) =
866 x86_cpu_to_apicid_init[cpu]; 866 x86_cpu_to_apicid_init[cpu];
867 per_cpu(x86_cpu_to_node_map, cpu) =
868 x86_cpu_to_node_map_init[cpu];
869 }
867 else 870 else
868 printk(KERN_NOTICE "per_cpu_offset zero for cpu %d\n", 871 printk(KERN_NOTICE "per_cpu_offset zero for cpu %d\n",
869 cpu); 872 cpu);
@@ -871,6 +874,7 @@ void __init smp_set_apicids(void)
871 874
872 /* indicate the early static arrays are gone */ 875 /* indicate the early static arrays are gone */
873 x86_cpu_to_apicid_early_ptr = NULL; 876 x86_cpu_to_apicid_early_ptr = NULL;
877 x86_cpu_to_node_map_early_ptr = NULL;
874} 878}
875 879
876static void __init smp_cpu_index_default(void) 880static void __init smp_cpu_index_default(void)
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c
index bc6dd5051d6..382377d6421 100644
--- a/arch/x86/mm/numa_64.c
+++ b/arch/x86/mm/numa_64.c
@@ -31,10 +31,14 @@ bootmem_data_t plat_node_bdata[MAX_NUMNODES];
31 31
32struct memnode memnode; 32struct memnode memnode;
33 33
34u16 cpu_to_node_map[NR_CPUS] __read_mostly = { 34u16 x86_cpu_to_node_map_init[NR_CPUS] __initdata = {
35 [0 ... NR_CPUS-1] = NUMA_NO_NODE 35 [0 ... NR_CPUS-1] = NUMA_NO_NODE
36}; 36};
37EXPORT_SYMBOL(cpu_to_node_map); 37void *x86_cpu_to_node_map_early_ptr;
38EXPORT_SYMBOL(x86_cpu_to_node_map_init);
39EXPORT_SYMBOL(x86_cpu_to_node_map_early_ptr);
40DEFINE_PER_CPU(u16, x86_cpu_to_node_map) = NUMA_NO_NODE;
41EXPORT_PER_CPU_SYMBOL(x86_cpu_to_node_map);
38 42
39u16 apicid_to_node[MAX_LOCAL_APIC] __cpuinitdata = { 43u16 apicid_to_node[MAX_LOCAL_APIC] __cpuinitdata = {
40 [0 ... MAX_LOCAL_APIC-1] = NUMA_NO_NODE 44 [0 ... MAX_LOCAL_APIC-1] = NUMA_NO_NODE
@@ -544,7 +548,7 @@ void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
544 node_set(0, node_possible_map); 548 node_set(0, node_possible_map);
545 for (i = 0; i < NR_CPUS; i++) 549 for (i = 0; i < NR_CPUS; i++)
546 numa_set_node(i, 0); 550 numa_set_node(i, 0);
547 /* we can't use cpumask_of_cpu() yet */ 551 /* cpumask_of_cpu() may not be available during early startup */
548 memset(&node_to_cpumask_map[0], 0, sizeof(node_to_cpumask_map[0])); 552 memset(&node_to_cpumask_map[0], 0, sizeof(node_to_cpumask_map[0]));
549 cpu_set(0, node_to_cpumask_map[0]); 553 cpu_set(0, node_to_cpumask_map[0]);
550 e820_register_active_regions(0, start_pfn, end_pfn); 554 e820_register_active_regions(0, start_pfn, end_pfn);
@@ -558,8 +562,16 @@ __cpuinit void numa_add_cpu(int cpu)
558 562
559void __cpuinit numa_set_node(int cpu, int node) 563void __cpuinit numa_set_node(int cpu, int node)
560{ 564{
565 u16 *cpu_to_node_map = (u16 *)x86_cpu_to_node_map_early_ptr;
566
561 cpu_pda(cpu)->nodenumber = node; 567 cpu_pda(cpu)->nodenumber = node;
562 cpu_to_node_map[cpu] = node; 568
569 if(cpu_to_node_map)
570 cpu_to_node_map[cpu] = node;
571 else if(per_cpu_offset(cpu))
572 per_cpu(x86_cpu_to_node_map, cpu) = node;
573 else
574 Dprintk(KERN_INFO "Setting node for non-present cpu %d\n", cpu);
563} 575}
564 576
565unsigned long __init numa_free_all_bootmem(void) 577unsigned long __init numa_free_all_bootmem(void)
diff --git a/include/asm-x86/numa_64.h b/include/asm-x86/numa_64.h
index 941889471b5..c797cd523d2 100644
--- a/include/asm-x86/numa_64.h
+++ b/include/asm-x86/numa_64.h
@@ -40,6 +40,4 @@ static inline void clear_node_cpumask(int cpu)
40#define clear_node_cpumask(cpu) do {} while (0) 40#define clear_node_cpumask(cpu) do {} while (0)
41#endif 41#endif
42 42
43#define NUMA_NO_NODE 0xffff
44
45#endif 43#endif
diff --git a/include/asm-x86/topology.h b/include/asm-x86/topology.h
index f8706b2a3d8..e612ed8d2bc 100644
--- a/include/asm-x86/topology.h
+++ b/include/asm-x86/topology.h
@@ -30,13 +30,24 @@
30#include <asm/mpspec.h> 30#include <asm/mpspec.h>
31 31
32/* Mappings between logical cpu number and node number */ 32/* Mappings between logical cpu number and node number */
33extern u16 cpu_to_node_map[]; 33DECLARE_PER_CPU(u16, x86_cpu_to_node_map);
34extern u16 __initdata x86_cpu_to_node_map_init[];
35extern void *x86_cpu_to_node_map_early_ptr;
34extern cpumask_t node_to_cpumask_map[]; 36extern cpumask_t node_to_cpumask_map[];
35 37
38#define NUMA_NO_NODE ((u16)(~0))
39
36/* Returns the number of the node containing CPU 'cpu' */ 40/* Returns the number of the node containing CPU 'cpu' */
37static inline int cpu_to_node(int cpu) 41static inline int cpu_to_node(int cpu)
38{ 42{
39 return cpu_to_node_map[cpu]; 43 u16 *cpu_to_node_map = (u16 *)x86_cpu_to_node_map_early_ptr;
44
45 if (cpu_to_node_map)
46 return cpu_to_node_map[cpu];
47 else if (per_cpu_offset(cpu))
48 return per_cpu(x86_cpu_to_node_map, cpu);
49 else
50 return NUMA_NO_NODE;
40} 51}
41 52
42/* 53/*
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index a4a6bf7deaa..4ad5fbbb18b 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -18,6 +18,7 @@
18#include <linux/mm.h> 18#include <linux/mm.h>
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/sched.h>
21 22
22#include <linux/sunrpc/types.h> 23#include <linux/sunrpc/types.h>
23#include <linux/sunrpc/xdr.h> 24#include <linux/sunrpc/xdr.h>