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

Christoph Lameter
2006-10-26T16:45:56Z

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.

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);