diff options
Diffstat (limited to 'kernel/cpu.c')
| -rw-r--r-- | kernel/cpu.c | 36 |
1 files changed, 9 insertions, 27 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c index 291ac586f37f..f8cced2692b3 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c | |||
| @@ -151,13 +151,13 @@ static inline void check_for_tasks(int cpu) | |||
| 151 | 151 | ||
| 152 | write_lock_irq(&tasklist_lock); | 152 | write_lock_irq(&tasklist_lock); |
| 153 | for_each_process(p) { | 153 | for_each_process(p) { |
| 154 | if (task_cpu(p) == cpu && | 154 | if (task_cpu(p) == cpu && p->state == TASK_RUNNING && |
| 155 | (!cputime_eq(p->utime, cputime_zero) || | 155 | (!cputime_eq(p->utime, cputime_zero) || |
| 156 | !cputime_eq(p->stime, cputime_zero))) | 156 | !cputime_eq(p->stime, cputime_zero))) |
| 157 | printk(KERN_WARNING "Task %s (pid = %d) is on cpu %d\ | 157 | printk(KERN_WARNING "Task %s (pid = %d) is on cpu %d " |
| 158 | (state = %ld, flags = %x) \n", | 158 | "(state = %ld, flags = %x)\n", |
| 159 | p->comm, task_pid_nr(p), cpu, | 159 | p->comm, task_pid_nr(p), cpu, |
| 160 | p->state, p->flags); | 160 | p->state, p->flags); |
| 161 | } | 161 | } |
| 162 | write_unlock_irq(&tasklist_lock); | 162 | write_unlock_irq(&tasklist_lock); |
| 163 | } | 163 | } |
| @@ -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: |
| @@ -349,7 +338,7 @@ int __cpuinit cpu_up(unsigned int cpu) | |||
| 349 | if (!cpu_possible(cpu)) { | 338 | if (!cpu_possible(cpu)) { |
| 350 | printk(KERN_ERR "can't online cpu %d because it is not " | 339 | printk(KERN_ERR "can't online cpu %d because it is not " |
| 351 | "configured as may-hotadd at boot time\n", cpu); | 340 | "configured as may-hotadd at boot time\n", cpu); |
| 352 | #if defined(CONFIG_IA64) || defined(CONFIG_X86_64) | 341 | #if defined(CONFIG_IA64) |
| 353 | printk(KERN_ERR "please check additional_cpus= boot " | 342 | printk(KERN_ERR "please check additional_cpus= boot " |
| 354 | "parameter\n"); | 343 | "parameter\n"); |
| 355 | #endif | 344 | #endif |
| @@ -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) |
