Hotplug CPU: don't check cpu_online after take_cpu_down

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Monday, July 28, 2008 - 10:05 am

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=043215...
Commit:     04321587584272f4e8b9818f319f40caf8eeee13
Parent:     ffdb5976c47609c862917d4c186ecbb5706d2dda
Author:     Rusty Russell <rusty@rustcorp.com.au>
AuthorDate: Mon Jul 28 12:16:29 2008 -0500
Committer:  Rusty Russell <rusty@rustcorp.com.au>
CommitDate: Mon Jul 28 12:16:29 2008 +1000

    Hotplug CPU: don't check cpu_online after take_cpu_down
    
    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>
---
 kernel/cpu.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/cpu.c b/kernel/cpu.c
index cf79bb9..53cf508 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -250,8 +250,7 @@ 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)
@@ -259,6 +258,7 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)
 
 		goto out_allowed;
 	}
+	BUG_ON(cpu_online(cpu));
 
 	/* Wait for it to sleep (leaving idle task). */
 	while (!idle_cpu(cpu))
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Hotplug CPU: don't check cpu_online after take_cpu_down, Linux Kernel Mailing ..., (Mon Jul 28, 10:05 am)