Skip to content

Commit

Permalink
Hotplug CPU: don't check cpu_online after take_cpu_down
Browse files Browse the repository at this point in the history
Akinobu points out that if take_cpu_down() succeeds, the cpu must be offline.
Remove the cpu_online() check, and put a BUG_ON().

Quoting Akinobu Mita:
   Actually the cpu_online() check was necessary before appling this
   stop_machine: simplify patch.

   With old __stop_machine_run(), __stop_machine_run() could succeed
   (return !IS_ERR(p) value) even if take_cpu_down() returned non-zero value.
   The return value of take_cpu_down() was obtained through kthread_stop()..

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: "Akinobu Mita" <akinobu.mita@gmail.com>
  • Loading branch information
Rusty Russell committed Jul 28, 2008
1 parent ffdb597 commit 0432158
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kernel/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,15 +250,15 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)
set_cpus_allowed_ptr(current, &tmp);

err = __stop_machine_run(take_cpu_down, &tcd_param, cpu);

if (err || cpu_online(cpu)) {
if (err) {
/* CPU didn't die: tell everyone. Can't complain. */
if (raw_notifier_call_chain(&cpu_chain, CPU_DOWN_FAILED | mod,
hcpu) == NOTIFY_BAD)
BUG();

goto out_allowed;
}
BUG_ON(cpu_online(cpu));

/* Wait for it to sleep (leaving idle task). */
while (!idle_cpu(cpu))
Expand Down

0 comments on commit 0432158

Please sign in to comment.