Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f549da848eca595abca14ebc5e1bf00fd72aa53d
Commit:     f549da848eca595abca14ebc5e1bf00fd72aa53d
Parent:     f8700df7c419781efb34696de7e7f49717f8ede7
Author:     Suresh Siddha <[EMAIL PROTECTED]>
AuthorDate: Thu Aug 23 15:18:02 2007 +0200
Committer:  Ingo Molnar <[EMAIL PROTECTED]>
CommitDate: Thu Aug 23 15:18:02 2007 +0200

    sched: skip updating rq's next_balance under null SD
    
    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 <[EMAIL PROTECTED]>
    Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
---
 kernel/sched.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index d96030d..a4b22d9 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -3043,6 +3043,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))
@@ -3079,8 +3080,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
@@ -3090,7 +3093,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;
 }
 
 /*
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to