aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/include/asm/topology.h6
-rw-r--r--arch/x86/kernel/smpboot.c4
-rw-r--r--arch/x86/mm/numa.c28
-rw-r--r--arch/x86/mm/numa_64.c14
4 files changed, 24 insertions, 28 deletions
diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
index dc31d929da04..f8b833e1257f 100644
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -86,15 +86,15 @@ static inline int early_cpu_to_node(int cpu)
86#endif /* CONFIG_X86_64 */ 86#endif /* CONFIG_X86_64 */
87 87
88/* Mappings between node number and cpus on that node. */ 88/* Mappings between node number and cpus on that node. */
89extern cpumask_t *node_to_cpumask_map; 89extern cpumask_var_t node_to_cpumask_map[MAX_NUMNODES];
90 90
91#ifdef CONFIG_DEBUG_PER_CPU_MAPS 91#ifdef CONFIG_DEBUG_PER_CPU_MAPS
92extern const cpumask_t *cpumask_of_node(int node); 92extern const cpumask_t *cpumask_of_node(int node);
93#else 93#else
94/* Returns a pointer to the cpumask of CPUs on Node 'node'. */ 94/* Returns a pointer to the cpumask of CPUs on Node 'node'. */
95static inline const cpumask_t *cpumask_of_node(int node) 95static inline const struct cpumask *cpumask_of_node(int node)
96{ 96{
97 return &node_to_cpumask_map[node]; 97 return node_to_cpumask_map[node];
98} 98}
99#endif 99#endif
100 100
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index c55639b1ab8a..5a58a45ac1e3 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -123,7 +123,7 @@ EXPORT_SYMBOL(cpu_to_node_map);
123static void map_cpu_to_node(int cpu, int node) 123static void map_cpu_to_node(int cpu, int node)
124{ 124{
125 printk(KERN_INFO "Mapping cpu %d to node %d\n", cpu, node); 125 printk(KERN_INFO "Mapping cpu %d to node %d\n", cpu, node);
126 cpumask_set_cpu(cpu, &node_to_cpumask_map[node]); 126 cpumask_set_cpu(cpu, node_to_cpumask_map[node]);
127 cpu_to_node_map[cpu] = node; 127 cpu_to_node_map[cpu] = node;
128} 128}
129 129
@@ -134,7 +134,7 @@ static void unmap_cpu_to_node(int cpu)
134 134
135 printk(KERN_INFO "Unmapping cpu %d from all nodes\n", cpu); 135 printk(KERN_INFO "Unmapping cpu %d from all nodes\n", cpu);
136 for (node = 0; node < MAX_NUMNODES; node++) 136 for (node = 0; node < MAX_NUMNODES; node++)
137 cpumask_clear_cpu(cpu, &node_to_cpumask_map[node]); 137 cpumask_clear_cpu(cpu, node_to_cpumask_map[node]);
138 cpu_to_node_map[cpu] = 0; 138 cpu_to_node_map[cpu] = 0;
139} 139}
140#else /* !(CONFIG_NUMA && CONFIG_X86_32) */ 140#else /* !(CONFIG_NUMA && CONFIG_X86_32) */
diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
index f3a19e939e80..429dc2d191fd 100644
--- a/arch/x86/mm/numa.c
+++ b/arch/x86/mm/numa.c
@@ -12,7 +12,7 @@
12/* 12/*
13 * Which logical CPUs are on which nodes 13 * Which logical CPUs are on which nodes
14 */ 14 */
15cpumask_t *node_to_cpumask_map; 15cpumask_var_t node_to_cpumask_map[MAX_NUMNODES];
16EXPORT_SYMBOL(node_to_cpumask_map); 16EXPORT_SYMBOL(node_to_cpumask_map);
17 17
18/* 18/*
@@ -25,7 +25,6 @@ EXPORT_SYMBOL(node_to_cpumask_map);
25void __init setup_node_to_cpumask_map(void) 25void __init setup_node_to_cpumask_map(void)
26{ 26{
27 unsigned int node, num = 0; 27 unsigned int node, num = 0;
28 cpumask_t *map;
29 28
30 /* setup nr_node_ids if not done yet */ 29 /* setup nr_node_ids if not done yet */
31 if (nr_node_ids == MAX_NUMNODES) { 30 if (nr_node_ids == MAX_NUMNODES) {
@@ -35,14 +34,11 @@ void __init setup_node_to_cpumask_map(void)
35 } 34 }
36 35
37 /* allocate the map */ 36 /* allocate the map */
38 map = alloc_bootmem_low(nr_node_ids * sizeof(cpumask_t)); 37 for (node = 0; node < nr_node_ids; node++)
39 DBG("node_to_cpumask_map at %p for %d nodes\n", map, nr_node_ids); 38 alloc_bootmem_cpumask_var(&node_to_cpumask_map[node]);
40 39
41 pr_debug("Node to cpumask map at %p for %d nodes\n", 40 /* cpumask_of_node() will now work */
42 map, nr_node_ids); 41 pr_debug("Node to cpumask map for %d nodes\n", nr_node_ids);
43
44 /* node_to_cpumask() will now work */
45 node_to_cpumask_map = map;
46} 42}
47 43
48#ifdef CONFIG_DEBUG_PER_CPU_MAPS 44#ifdef CONFIG_DEBUG_PER_CPU_MAPS
@@ -51,13 +47,6 @@ void __init setup_node_to_cpumask_map(void)
51 */ 47 */
52const cpumask_t *cpumask_of_node(int node) 48const cpumask_t *cpumask_of_node(int node)
53{ 49{
54 if (node_to_cpumask_map == NULL) {
55 printk(KERN_WARNING
56 "cpumask_of_node(%d): no node_to_cpumask_map!\n",
57 node);
58 dump_stack();
59 return cpu_online_mask;
60 }
61 if (node >= nr_node_ids) { 50 if (node >= nr_node_ids) {
62 printk(KERN_WARNING 51 printk(KERN_WARNING
63 "cpumask_of_node(%d): node > nr_node_ids(%d)\n", 52 "cpumask_of_node(%d): node > nr_node_ids(%d)\n",
@@ -65,6 +54,13 @@ const cpumask_t *cpumask_of_node(int node)
65 dump_stack(); 54 dump_stack();
66 return cpu_none_mask; 55 return cpu_none_mask;
67 } 56 }
57 if (node_to_cpumask_map[node] == NULL) {
58 printk(KERN_WARNING
59 "cpumask_of_node(%d): no node_to_cpumask_map!\n",
60 node);
61 dump_stack();
62 return cpu_online_mask;
63 }
68 return &node_to_cpumask_map[node]; 64 return &node_to_cpumask_map[node];
69} 65}
70EXPORT_SYMBOL(cpumask_of_node); 66EXPORT_SYMBOL(cpumask_of_node);
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c
index eee149078862..9d2b3d2625cd 100644
--- a/arch/x86/mm/numa_64.c
+++ b/arch/x86/mm/numa_64.c
@@ -681,12 +681,12 @@ void __cpuinit numa_clear_node(int cpu)
681 681
682void __cpuinit numa_add_cpu(int cpu) 682void __cpuinit numa_add_cpu(int cpu)
683{ 683{
684 cpu_set(cpu, node_to_cpumask_map[early_cpu_to_node(cpu)]); 684 cpumask_set_cpu(cpu, node_to_cpumask_map[early_cpu_to_node(cpu)]);
685} 685}
686 686
687void __cpuinit numa_remove_cpu(int cpu) 687void __cpuinit numa_remove_cpu(int cpu)
688{ 688{
689 cpu_clear(cpu, node_to_cpumask_map[early_cpu_to_node(cpu)]); 689 cpumask_clear_cpu(cpu, node_to_cpumask_map[early_cpu_to_node(cpu)]);
690} 690}
691 691
692#else /* CONFIG_DEBUG_PER_CPU_MAPS */ 692#else /* CONFIG_DEBUG_PER_CPU_MAPS */
@@ -700,17 +700,17 @@ static void __cpuinit numa_set_cpumask(int cpu, int enable)
700 cpumask_t *mask; 700 cpumask_t *mask;
701 char buf[64]; 701 char buf[64];
702 702
703 if (node_to_cpumask_map == NULL) { 703 mask = node_to_cpumask_map[node];
704 printk(KERN_ERR "node_to_cpumask_map NULL\n"); 704 if (mask == NULL) {
705 printk(KERN_ERR "node_to_cpumask_map[%i] NULL\n", node);
705 dump_stack(); 706 dump_stack();
706 return; 707 return;
707 } 708 }
708 709
709 mask = &node_to_cpumask_map[node];
710 if (enable) 710 if (enable)
711 cpu_set(cpu, *mask); 711 cpumask_set_cpu(cpu, mask);
712 else 712 else
713 cpu_clear(cpu, *mask); 713 cpumask_clear_cpu(cpu, mask);
714 714
715 cpulist_scnprintf(buf, sizeof(buf), mask); 715 cpulist_scnprintf(buf, sizeof(buf), mask);
716 printk(KERN_DEBUG "%s cpu %d node %d: mask now %s\n", 716 printk(KERN_DEBUG "%s cpu %d node %d: mask now %s\n",