diff options
Diffstat (limited to 'kernel/cpu.c')
-rw-r--r-- | kernel/cpu.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c index cfb1d43ab801..a1ac7ea245d7 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c | |||
@@ -64,6 +64,8 @@ void __init cpu_hotplug_init(void) | |||
64 | cpu_hotplug.refcount = 0; | 64 | cpu_hotplug.refcount = 0; |
65 | } | 65 | } |
66 | 66 | ||
67 | cpumask_t cpu_active_map; | ||
68 | |||
67 | #ifdef CONFIG_HOTPLUG_CPU | 69 | #ifdef CONFIG_HOTPLUG_CPU |
68 | 70 | ||
69 | void get_online_cpus(void) | 71 | void get_online_cpus(void) |
@@ -291,11 +293,20 @@ int __ref cpu_down(unsigned int cpu) | |||
291 | int err = 0; | 293 | int err = 0; |
292 | 294 | ||
293 | cpu_maps_update_begin(); | 295 | cpu_maps_update_begin(); |
294 | if (cpu_hotplug_disabled) | 296 | |
297 | if (cpu_hotplug_disabled) { | ||
295 | err = -EBUSY; | 298 | err = -EBUSY; |
296 | else | 299 | goto out; |
297 | err = _cpu_down(cpu, 0); | 300 | } |
301 | |||
302 | cpu_clear(cpu, cpu_active_map); | ||
303 | |||
304 | err = _cpu_down(cpu, 0); | ||
305 | |||
306 | if (cpu_online(cpu)) | ||
307 | cpu_set(cpu, cpu_active_map); | ||
298 | 308 | ||
309 | out: | ||
299 | cpu_maps_update_done(); | 310 | cpu_maps_update_done(); |
300 | return err; | 311 | return err; |
301 | } | 312 | } |
@@ -355,11 +366,18 @@ int __cpuinit cpu_up(unsigned int cpu) | |||
355 | } | 366 | } |
356 | 367 | ||
357 | cpu_maps_update_begin(); | 368 | cpu_maps_update_begin(); |
358 | if (cpu_hotplug_disabled) | 369 | |
370 | if (cpu_hotplug_disabled) { | ||
359 | err = -EBUSY; | 371 | err = -EBUSY; |
360 | else | 372 | goto out; |
361 | err = _cpu_up(cpu, 0); | 373 | } |
362 | 374 | ||
375 | err = _cpu_up(cpu, 0); | ||
376 | |||
377 | if (cpu_online(cpu)) | ||
378 | cpu_set(cpu, cpu_active_map); | ||
379 | |||
380 | out: | ||
363 | cpu_maps_update_done(); | 381 | cpu_maps_update_done(); |
364 | return err; | 382 | return err; |
365 | } | 383 | } |