public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC] NOHZ: fix nohz on cpu unplug
@ 2009-01-30 16:29 Christian Borntraeger
  2009-02-02  9:58 ` [PATCH/RFC] " Christian Borntraeger
  0 siblings, 1 reply; 12+ messages in thread
From: Christian Borntraeger @ 2009-01-30 16:29 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner
  Cc: linux-kernel, Heiko Carstens, Martin Schwidefsky

Ingo, Thomas,

After using cpu unplug I have seen one cpu with enabled ticks on s390,
even on a idle systems. It turned 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 the weights of
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.

One possible fix is to only add the cpu to the nohz.cpu_mask,
if the cpu is active.

The alternative is to add nohz.cpu_mask in the cpu hotplug path.

This patch seems to work on s390 (Shortly tested with kvm guests
with cpu hotplug and kvm_stat on the host), but I want to hear your
opinion.

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

Index: kvm/kernel/sched.c
===================================================================
--- kvm.orig/kernel/sched.c
+++ kvm/kernel/sched.c
@@ -3880,7 +3880,8 @@ int select_nohz_load_balancer(int stop_t
 	int cpu = smp_processor_id();
 
 	if (stop_tick) {
-		cpumask_set_cpu(cpu, nohz.cpu_mask);
+		if (cpu_active(cpu))
+			cpumask_set_cpu(cpu, nohz.cpu_mask);
 		cpu_rq(cpu)->in_nohz_recently = 1;
 
 		/*

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2009-02-06 14:52 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-30 16:29 [RFC] NOHZ: fix nohz on cpu unplug Christian Borntraeger
2009-02-02  9:58 ` [PATCH/RFC] " Christian Borntraeger
2009-02-02 12:23   ` [PATCH v2] " Christian Borntraeger
2009-02-02 23:57     ` Suresh Siddha
2009-02-03  8:48       ` Christian Borntraeger
2009-02-03 12:28         ` Ingo Molnar
2009-02-04  6:19           ` Christian Borntraeger
2009-02-04 19:59             ` Suresh Siddha
2009-02-04 21:32               ` Ingo Molnar
2009-02-05 19:54                 ` Mark Lord
2009-02-06  2:33                   ` Suresh Siddha
2009-02-06 14:52                     ` Mark Lord

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox