[PATCH v2] NOHZ: fix nohz on cpu unplug

From: Christian Borntraeger
Date: Mon Feb 02 2009 - 07:24:00 EST


After some testing, I think this patch is better:
[PATCH] NOHZ: fix nohz on cpu unplug

From: Christian Borntraeger <borntraeger@xxxxxxxxxx>

After using cpu unplug I have seen one cpu with full ticks, even
on a idle systems. It turns out that nohz.cpu_mask is not updated on
cpu unplug.
In select_nohz_load_balancer we check if the system is completely
idle to turn of load balancing. We compare cpu_online_map with
nohz.cpu_mask.
Since cpu_online_map is updated on cpu unplug, but nohz.cpu_mask is
not, the check fails and the scheduler believes that we need an
"idle load balancer" even on a fully idle system. Since the ilb
cpu does not deactivate the timer tick this breaks NOHZ.

This patch clear the nohz bits in the migration_call, a function that
is already called by the cpu hotplug notifier.

Opinions?

Signed-off-by: Christian Borntraeger <borntraeger@xxxxxxxxxx>
---
kernel/sched.c | 1 +
1 file changed, 1 insertion(+)

Index: kvm/kernel/sched.c
===================================================================
--- kvm.orig/kernel/sched.c
+++ kvm/kernel/sched.c
@@ -6696,6 +6696,7 @@ migration_call(struct notifier_block *nf
rq->idle->sched_class = &idle_sched_class;
migrate_dead_tasks(cpu);
spin_unlock_irq(&rq->lock);
+ cpumask_clear_cpu(cpu, nohz.cpu_mask);
cpuset_unlock();
migrate_nr_uninterruptible(rq);
BUG_ON(rq->nr_running != 0);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/