aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/setup.c
diff options
context:
space:
mode:
authorMike Travis <travis@sgi.com>2008-04-04 21:11:01 -0400
committerIngo Molnar <mingo@elte.hu>2008-04-19 13:44:59 -0400
commit9f0e8d0400d925c3acd5f4e01dbeb736e4011882 (patch)
tree970dab54eeba019e4649aa32730489206be5f8a2 /arch/x86/kernel/setup.c
parent321a8e9dcb714f3c350ba55e41ed447bf3f05fac (diff)
x86: convert cpumask_of_cpu macro to allocated array
* Here is a simple patch to use an allocated array of cpumasks to represent cpumask_of_cpu() instead of constructing one on the stack. It's based on the Kconfig option "HAVE_CPUMASK_OF_CPU_MAP" which is currently only set for x86_64 SMP. Otherwise the the existing cpumask_of_cpu() is used but has been changed to produce an lvalue so a pointer to it can be used. Cc: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Christoph Lameter <clameter@sgi.com> Signed-off-by: Mike Travis <travis@sgi.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/setup.c')
-rw-r--r--arch/x86/kernel/setup.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index ed157c90412e..0d1f44ae6eea 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -54,6 +54,24 @@ static void __init setup_per_cpu_maps(void)
54#endif 54#endif
55} 55}
56 56
57#ifdef CONFIG_HAVE_CPUMASK_OF_CPU_MAP
58cpumask_t *cpumask_of_cpu_map __read_mostly;
59EXPORT_SYMBOL(cpumask_of_cpu_map);
60
61/* requires nr_cpu_ids to be initialized */
62static void __init setup_cpumask_of_cpu(void)
63{
64 int i;
65
66 /* alloc_bootmem zeroes memory */
67 cpumask_of_cpu_map = alloc_bootmem_low(sizeof(cpumask_t) * nr_cpu_ids);
68 for (i = 0; i < nr_cpu_ids; i++)
69 cpu_set(i, cpumask_of_cpu_map[i]);
70}
71#else
72static inline void setup_cpumask_of_cpu(void) { }
73#endif
74
57#ifdef CONFIG_X86_32 75#ifdef CONFIG_X86_32
58/* 76/*
59 * Great future not-so-futuristic plan: make i386 and x86_64 do it 77 * Great future not-so-futuristic plan: make i386 and x86_64 do it
@@ -70,7 +88,7 @@ EXPORT_SYMBOL(__per_cpu_offset);
70 */ 88 */
71void __init setup_per_cpu_areas(void) 89void __init setup_per_cpu_areas(void)
72{ 90{
73 int i; 91 int i, highest_cpu = 0;
74 unsigned long size; 92 unsigned long size;
75 93
76#ifdef CONFIG_HOTPLUG_CPU 94#ifdef CONFIG_HOTPLUG_CPU
@@ -104,10 +122,18 @@ void __init setup_per_cpu_areas(void)
104 __per_cpu_offset[i] = ptr - __per_cpu_start; 122 __per_cpu_offset[i] = ptr - __per_cpu_start;
105#endif 123#endif
106 memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); 124 memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start);
125
126 highest_cpu = i;
107 } 127 }
108 128
129 nr_cpu_ids = highest_cpu + 1;
130 printk(KERN_DEBUG "NR_CPUS: %d, nr_cpu_ids: %d\n", NR_CPUS, nr_cpu_ids);
131
109 /* Setup percpu data maps */ 132 /* Setup percpu data maps */
110 setup_per_cpu_maps(); 133 setup_per_cpu_maps();
134
135 /* Setup cpumask_of_cpu map */
136 setup_cpumask_of_cpu();
111} 137}
112 138
113#endif 139#endif