diff options
Diffstat (limited to 'kernel/sched.c')
-rw-r--r-- | kernel/sched.c | 14 |
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); |
3081 | out: | 3082 | out: |
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 | /* |