Re: [PATCH 3/5] Use next_balance instead of last_balance

From: Nick Piggin
Date: Thu Oct 26 2006 - 13:14:17 EST


Christoph Lameter wrote:
On Thu, 26 Oct 2006, Nick Piggin wrote:


Actually, it is wrong, so nack.

You didn't take into account that balance_interval may have changed,
and so might the idle status.


Hmmmm... We change the point at which we calculate the interval relative to load balancing. So move it after the load balance. This also avoids having to do the calculation if the sched_domain has not expired.

That still doesn't take into account if the CPU goes idle/busy during
the interval.


Want a new rollup/testing cycle for all of this?

Index: linux-2.6.19-rc3/kernel/sched.c
===================================================================
--- linux-2.6.19-rc3.orig/kernel/sched.c 2006-10-26 11:31:04.000000000 -0500
+++ linux-2.6.19-rc3/kernel/sched.c 2006-10-26 11:41:07.129561438 -0500
@@ -2867,15 +2867,6 @@ static void rebalance_domains(unsigned l
if (!(sd->flags & SD_LOAD_BALANCE))
continue;
- interval = sd->balance_interval;
- if (idle != SCHED_IDLE)
- interval *= sd->busy_factor;
-
- /* scale ms to jiffies */
- interval = msecs_to_jiffies(interval);
- if (unlikely(!interval))
- interval = 1;
-
if (jiffies >= sd->next_balance) {
if (load_balance(this_cpu, this_rq, sd, idle)) {
/*
@@ -2885,6 +2876,14 @@ static void rebalance_domains(unsigned l
*/
idle = NOT_IDLE;
}
+ interval = sd->balance_interval;
+ if (idle != SCHED_IDLE)
+ interval *= sd->busy_factor;
+
+ /* scale ms to jiffies */
+ interval = msecs_to_jiffies(interval);
+ if (unlikely(!interval))
+ interval = 1;
sd->next_balance += interval;
}
next_balance = min(next_balance, sd->next_balance);



--
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com -
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/