Commit f549da848eca595abca14ebc5e1bf00fd72aa53d
Committed by
Ingo Molnar
1 parent
f8700df7c4
Exists in
master
and in
4 other branches
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>
Showing 1 changed file with 12 additions and 2 deletions Side-by-side Diff
kernel/sched.c
... | ... | @@ -3043,6 +3043,7 @@ |
3043 | 3043 | struct sched_domain *sd; |
3044 | 3044 | /* Earliest time when we have to do rebalance again */ |
3045 | 3045 | unsigned long next_balance = jiffies + 60*HZ; |
3046 | + int update_next_balance = 0; | |
3046 | 3047 | |
3047 | 3048 | for_each_domain(cpu, sd) { |
3048 | 3049 | if (!(sd->flags & SD_LOAD_BALANCE)) |
3049 | 3050 | |
... | ... | @@ -3079,8 +3080,10 @@ |
3079 | 3080 | if (sd->flags & SD_SERIALIZE) |
3080 | 3081 | spin_unlock(&balancing); |
3081 | 3082 | out: |
3082 | - if (time_after(next_balance, sd->last_balance + interval)) | |
3083 | + if (time_after(next_balance, sd->last_balance + interval)) { | |
3083 | 3084 | next_balance = sd->last_balance + interval; |
3085 | + update_next_balance = 1; | |
3086 | + } | |
3084 | 3087 | |
3085 | 3088 | /* |
3086 | 3089 | * Stop the load balance at this level. There is another |
... | ... | @@ -3090,7 +3093,14 @@ |
3090 | 3093 | if (!balance) |
3091 | 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 | /* |