aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/setup_percpu.c
diff options
context:
space:
mode:
authorYinghai Lu <yhlu.kernel@gmail.com>2008-08-19 23:49:44 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-16 10:52:03 -0400
commit1f3fcd4b1adc972d5c6a34cfed98931c46575b49 (patch)
treea79b6c656a09a8424863a0025d5b20e7264d6999 /arch/x86/kernel/setup_percpu.c
parent3ddfda11861d305b02ed810b522dcf48b74ca808 (diff)
add per_cpu_dyn_array support
allow dyn-array in per_cpu area, allocated dynamically. usage: | /* in .h */ | struct kernel_stat { | struct cpu_usage_stat cpustat; | unsigned int *irqs; | }; | | /* in .c */ | DEFINE_PER_CPU(struct kernel_stat, kstat); | | DEFINE_PER_CPU_DYN_ARRAY_ADDR(per_cpu__kstat_irqs, per_cpu__kstat.irqs, sizeof(unsigned int), nr_irqs, sizeof(unsigned long), NULL); after setup_percpu()/per_cpu_alloc_dyn_array(), the dyn_array in per_cpu area is ready to use. Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/setup_percpu.c')
-rw-r--r--arch/x86/kernel/setup_percpu.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c
index 0e67f72d9316..13ba7a83808d 100644
--- a/arch/x86/kernel/setup_percpu.c
+++ b/arch/x86/kernel/setup_percpu.c
@@ -140,7 +140,7 @@ static void __init setup_cpu_pda_map(void)
140 */ 140 */
141void __init setup_per_cpu_areas(void) 141void __init setup_per_cpu_areas(void)
142{ 142{
143 ssize_t size = PERCPU_ENOUGH_ROOM; 143 ssize_t size, old_size;
144 char *ptr; 144 char *ptr;
145 int cpu; 145 int cpu;
146 146
@@ -148,7 +148,8 @@ void __init setup_per_cpu_areas(void)
148 setup_cpu_pda_map(); 148 setup_cpu_pda_map();
149 149
150 /* Copy section for each CPU (we discard the original) */ 150 /* Copy section for each CPU (we discard the original) */
151 size = PERCPU_ENOUGH_ROOM; 151 old_size = PERCPU_ENOUGH_ROOM;
152 size = old_size + per_cpu_dyn_array_size();
152 printk(KERN_INFO "PERCPU: Allocating %zd bytes of per cpu data\n", 153 printk(KERN_INFO "PERCPU: Allocating %zd bytes of per cpu data\n",
153 size); 154 size);
154 155
@@ -176,6 +177,8 @@ void __init setup_per_cpu_areas(void)
176 per_cpu_offset(cpu) = ptr - __per_cpu_start; 177 per_cpu_offset(cpu) = ptr - __per_cpu_start;
177 memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); 178 memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start);
178 179
180 per_cpu_alloc_dyn_array(cpu, ptr + old_size);
181
179 } 182 }
180 183
181 printk(KERN_DEBUG "NR_CPUS: %d, nr_cpu_ids: %d, nr_node_ids %d\n", 184 printk(KERN_DEBUG "NR_CPUS: %d, nr_cpu_ids: %d, nr_node_ids %d\n",