public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] sched: skip updating  rq's next_balance under null SD
@ 2007-08-16  1:04 Siddha, Suresh B
  2007-08-23 10:38 ` Ingo Molnar
  0 siblings, 1 reply; 2+ messages in thread
From: Siddha, Suresh B @ 2007-08-16  1:04 UTC (permalink / raw)
  To: mingo; +Cc: nickpiggin, linux-kernel, akpm

Was playing with sched_smt_power_savings/sched_mc_power_savings and found
out that while the scheduler domains are reconstructed when sysfs settings
change, rebalance_domains() can get triggered with null domain on other cpus,
which is setting next_balance to jiffies + 60*HZ. Resulting in no idle/busy
balancing for 60 seconds.

Fix this.

Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
---

diff --git a/kernel/sched.c b/kernel/sched.c
index 45e17b8..74565c0 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -3020,6 +3020,7 @@ static inline void rebalance_domains(int cpu, enum cpu_idle_type idle)
 	struct sched_domain *sd;
 	/* Earliest time when we have to do rebalance again */
 	unsigned long next_balance = jiffies + 60*HZ;
+	int update_next_balance = 0;
 
 	for_each_domain(cpu, sd) {
 		if (!(sd->flags & SD_LOAD_BALANCE))
@@ -3056,8 +3057,10 @@ static inline void rebalance_domains(int cpu, enum cpu_idle_type idle)
 		if (sd->flags & SD_SERIALIZE)
 			spin_unlock(&balancing);
 out:
-		if (time_after(next_balance, sd->last_balance + interval))
+		if (time_after(next_balance, sd->last_balance + interval)) {
 			next_balance = sd->last_balance + interval;
+			update_next_balance = 1;
+		}
 
 		/*
 		 * Stop the load balance at this level. There is another
@@ -3067,7 +3070,14 @@ out:
 		if (!balance)
 			break;
 	}
-	rq->next_balance = next_balance;
+
+	/*
+	 * next_balance will be updated only when there is a need.
+	 * When the cpu is attached to null domain for ex, it will not be
+	 * updated.
+	 */
+	if (likely(update_next_balance))
+		rq->next_balance = next_balance;
 }
 
 /*

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

* Re: [patch] sched: skip updating  rq's next_balance under null SD
  2007-08-16  1:04 [patch] sched: skip updating rq's next_balance under null SD Siddha, Suresh B
@ 2007-08-23 10:38 ` Ingo Molnar
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2007-08-23 10:38 UTC (permalink / raw)
  To: Siddha, Suresh B; +Cc: nickpiggin, linux-kernel, akpm


* Siddha, Suresh B <suresh.b.siddha@intel.com> wrote:

> Was playing with sched_smt_power_savings/sched_mc_power_savings and 
> found out that while the scheduler domains are reconstructed when 
> sysfs settings change, rebalance_domains() can get triggered with null 
> domain on other cpus, which is setting next_balance to jiffies + 
> 60*HZ. Resulting in no idle/busy balancing for 60 seconds.
> 
> Fix this.

thanks, applied.

	Ingo

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

end of thread, other threads:[~2007-08-23 10:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-16  1:04 [patch] sched: skip updating rq's next_balance under null SD Siddha, Suresh B
2007-08-23 10:38 ` Ingo Molnar

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