linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sched: Replace NR_CPUS with num_online_cpus()
@ 2011-03-26 12:52 Sisir Koppaka
  2011-03-31 12:40 ` [tip:sched/urgent] sched: Fix rebalance interval calculation tip-bot for Sisir Koppaka
  0 siblings, 1 reply; 2+ messages in thread
From: Sisir Koppaka @ 2011-03-26 12:52 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, linux-kernel

The interval for checking scheduling domains if they are due to be
balanced currently depends on boot state NR_CPUS, which may not
accurately reflect the number of online CPUs at the time of check.

Signed-off-by: Sisir Koppaka <sisir.koppaka@gmail.com>
---
 kernel/sched_fair.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 3f7ec9e..c7ec5c8 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -22,6 +22,7 @@

 #include <linux/latencytop.h>
 #include <linux/sched.h>
+#include <linux/cpumask.h>

 /*
  * Targeted preemption latency for CPU-bound tasks:
@@ -3850,8 +3851,8 @@ static void rebalance_domains(int cpu, enum
cpu_idle_type idle)
 		interval = msecs_to_jiffies(interval);
 		if (unlikely(!interval))
 			interval = 1;
-		if (interval > HZ*NR_CPUS/10)
-			interval = HZ*NR_CPUS/10;
+		if (interval > HZ*num_online_cpus()/10)
+			interval = HZ*num_online_cpus()/10;

 		need_serialize = sd->flags & SD_SERIALIZE;

-- 
1.7.0.4

Sisir

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

end of thread, other threads:[~2011-03-31 12:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-26 12:52 [PATCH] sched: Replace NR_CPUS with num_online_cpus() Sisir Koppaka
2011-03-31 12:40 ` [tip:sched/urgent] sched: Fix rebalance interval calculation tip-bot for Sisir Koppaka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).