aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm/numa.c
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2009-03-13 00:19:53 -0400
committerRusty Russell <rusty@rustcorp.com.au>2009-03-13 00:19:53 -0400
commitc032ef60d1aa9af33730b7a35bbea751b131adc1 (patch)
tree3c3a274c92d29383f1d6b07ab098666d3525a251 /arch/x86/mm/numa.c
parent71ee73e72228775a076a502b3c92028fa59e2889 (diff)
cpumask: convert node_to_cpumask_map[] to cpumask_var_t
Impact: reduce kernel memory usage when CONFIG_CPUMASK_OFFSTACK=y Straightforward conversion: done for 32 and 64 bit kernels. node_to_cpumask_map is now a cpumask_var_t array. 64-bit used to be a dynamic cpumask_t array, and 32-bit used to be a static cpumask_t array. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'arch/x86/mm/numa.c')
-rw-r--r--arch/x86/mm/numa.c28
1 files changed, 12 insertions, 16 deletions
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);