aboutsummaryrefslogtreecommitdiffstats
path: root/arch
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 /arch
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>
Diffstat (limited to 'arch')
-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
3 files changed, 24 insertions, 6 deletions
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c
index e2beb4cba15f..529e45c37b1c 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 a2076b5f12af..a8bc2bcdb74a 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 bc6dd5051d60..382377d6421d 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)