summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-02-05 13:03:28 +0100
committerIngo Molnar <mingo@elte.hu>2009-02-05 13:03:35 +0100
commit83895147b702434e6f236deeca75211fd0e3da3a (patch)
tree550a8a8828592d9aa110d1851cc52e0f2c95bac7 /kernel
parentx86: fix hpet timer reinit for x86_64 (diff)
parentsched: fix nohz load balancer on cpu offline (diff)
downloadlinux-83895147b702434e6f236deeca75211fd0e3da3a.tar.xz
linux-83895147b702434e6f236deeca75211fd0e3da3a.zip
Merge branch 'sched/urgent' into timers/urgent
Merging it here because an upcoming timers/urgent fix relies on a change already in sched/urgent and not yet upstream. Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 242d0d47a70d..e1fc67d0674c 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -3890,19 +3890,24 @@ int select_nohz_load_balancer(int stop_tick)
int cpu = smp_processor_id();
if (stop_tick) {
- cpumask_set_cpu(cpu, nohz.cpu_mask);
cpu_rq(cpu)->in_nohz_recently = 1;
- /*
- * If we are going offline and still the leader, give up!
- */
- if (!cpu_active(cpu) &&
- atomic_read(&nohz.load_balancer) == cpu) {
+ if (!cpu_active(cpu)) {
+ if (atomic_read(&nohz.load_balancer) != cpu)
+ return 0;
+
+ /*
+ * If we are going offline and still the leader,
+ * give up!
+ */
if (atomic_cmpxchg(&nohz.load_balancer, cpu, -1) != cpu)
BUG();
+
return 0;
}
+ cpumask_set_cpu(cpu, nohz.cpu_mask);
+
/* time for ilb owner also to sleep */
if (cpumask_weight(nohz.cpu_mask) == num_online_cpus()) {
if (atomic_read(&nohz.load_balancer) == cpu)