aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
authorSuresh Siddha <suresh.b.siddha@intel.com>2007-08-23 09:18:02 -0400
committerIngo Molnar <mingo@elte.hu>2007-08-23 09:18:02 -0400
commitf549da848eca595abca14ebc5e1bf00fd72aa53d (patch)
tree25069c378b06c23f9f12a9e08c8f670d899f188b /kernel/sched.c
parentf8700df7c419781efb34696de7e7f49717f8ede7 (diff)
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 <suresh.b.siddha@intel.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index d96030db8ff7..a4b22d93e00d 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)
3043 struct sched_domain *sd; 3043 struct sched_domain *sd;
3044 /* Earliest time when we have to do rebalance again */ 3044 /* Earliest time when we have to do rebalance again */
3045 unsigned long next_balance = jiffies + 60*HZ; 3045 unsigned long next_balance = jiffies + 60*HZ;
3046 int update_next_balance = 0;
3046 3047
3047 for_each_domain(cpu, sd) { 3048 for_each_domain(cpu, sd) {
3048 if (!(sd->flags & SD_LOAD_BALANCE)) 3049 if (!(sd->flags & SD_LOAD_BALANCE))
@@ -3079,8 +3080,10 @@ static inline void rebalance_domains(int cpu, enum cpu_idle_type idle)
3079 if (sd->flags & SD_SERIALIZE) 3080 if (sd->flags & SD_SERIALIZE)
3080 spin_unlock(&balancing); 3081 spin_unlock(&balancing);
3081out: 3082out:
3082 if (time_after(next_balance, sd->last_balance + interval)) 3083 if (time_after(next_balance, sd->last_balance + interval)) {
3083 next_balance = sd->last_balance + interval; 3084 next_balance = sd->last_balance + interval;
3085 update_next_balance = 1;
3086 }
3084 3087
3085 /* 3088 /*
3086 * Stop the load balance at this level. There is another 3089 * Stop the load balance at this level. There is another
@@ -3090,7 +3093,14 @@ out:
3090 if (!balance) 3093 if (!balance)
3091 break; 3094 break;
3092 } 3095 }
3093 rq->next_balance = next_balance; 3096
3097 /*
3098 * next_balance will be updated only when there is a need.
3099 * When the cpu is attached to null domain for ex, it will not be
3100 * updated.
3101 */
3102 if (likely(update_next_balance))
3103 rq->next_balance = next_balance;
3094} 3104}
3095 3105
3096/* 3106/*