diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/cpu.c | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c index 291ac586f37f..1c8ddd6ee940 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c | |||
@@ -209,6 +209,7 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen) | |||
209 | return -ENOMEM; | 209 | return -ENOMEM; |
210 | 210 | ||
211 | cpu_hotplug_begin(); | 211 | cpu_hotplug_begin(); |
212 | set_cpu_active(cpu, false); | ||
212 | err = __raw_notifier_call_chain(&cpu_chain, CPU_DOWN_PREPARE | mod, | 213 | err = __raw_notifier_call_chain(&cpu_chain, CPU_DOWN_PREPARE | mod, |
213 | hcpu, -1, &nr_calls); | 214 | hcpu, -1, &nr_calls); |
214 | if (err == NOTIFY_BAD) { | 215 | if (err == NOTIFY_BAD) { |
@@ -280,18 +281,6 @@ int __ref cpu_down(unsigned int cpu) | |||
280 | goto out; | 281 | goto out; |
281 | } | 282 | } |
282 | 283 | ||
283 | set_cpu_active(cpu, false); | ||
284 | |||
285 | /* | ||
286 | * Make sure the all cpus did the reschedule and are not | ||
287 | * using stale version of the cpu_active_mask. | ||
288 | * This is not strictly necessary becuase stop_machine() | ||
289 | * that we run down the line already provides the required | ||
290 | * synchronization. But it's really a side effect and we do not | ||
291 | * want to depend on the innards of the stop_machine here. | ||
292 | */ | ||
293 | synchronize_sched(); | ||
294 | |||
295 | err = _cpu_down(cpu, 0); | 284 | err = _cpu_down(cpu, 0); |
296 | 285 | ||
297 | out: | 286 | out: |
@@ -382,19 +371,12 @@ int disable_nonboot_cpus(void) | |||
382 | return error; | 371 | return error; |
383 | cpu_maps_update_begin(); | 372 | cpu_maps_update_begin(); |
384 | first_cpu = cpumask_first(cpu_online_mask); | 373 | first_cpu = cpumask_first(cpu_online_mask); |
385 | /* We take down all of the non-boot CPUs in one shot to avoid races | 374 | /* |
375 | * We take down all of the non-boot CPUs in one shot to avoid races | ||
386 | * with the userspace trying to use the CPU hotplug at the same time | 376 | * with the userspace trying to use the CPU hotplug at the same time |
387 | */ | 377 | */ |
388 | cpumask_clear(frozen_cpus); | 378 | cpumask_clear(frozen_cpus); |
389 | 379 | ||
390 | for_each_online_cpu(cpu) { | ||
391 | if (cpu == first_cpu) | ||
392 | continue; | ||
393 | set_cpu_active(cpu, false); | ||
394 | } | ||
395 | |||
396 | synchronize_sched(); | ||
397 | |||
398 | printk("Disabling non-boot CPUs ...\n"); | 380 | printk("Disabling non-boot CPUs ...\n"); |
399 | for_each_online_cpu(cpu) { | 381 | for_each_online_cpu(cpu) { |
400 | if (cpu == first_cpu) | 382 | if (cpu == first_cpu) |