aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/sched.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 8a1257b65560..90329f1f8941 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -3668,6 +3668,7 @@ static void rebalance_domains(int cpu, enum cpu_idle_type idle)
3668 /* Earliest time when we have to do rebalance again */ 3668 /* Earliest time when we have to do rebalance again */
3669 unsigned long next_balance = jiffies + 60*HZ; 3669 unsigned long next_balance = jiffies + 60*HZ;
3670 int update_next_balance = 0; 3670 int update_next_balance = 0;
3671 int need_serialize;
3671 cpumask_t tmp; 3672 cpumask_t tmp;
3672 3673
3673 for_each_domain(cpu, sd) { 3674 for_each_domain(cpu, sd) {
@@ -3685,8 +3686,9 @@ static void rebalance_domains(int cpu, enum cpu_idle_type idle)
3685 if (interval > HZ*NR_CPUS/10) 3686 if (interval > HZ*NR_CPUS/10)
3686 interval = HZ*NR_CPUS/10; 3687 interval = HZ*NR_CPUS/10;
3687 3688
3689 need_serialize = sd->flags & SD_SERIALIZE;
3688 3690
3689 if (sd->flags & SD_SERIALIZE) { 3691 if (need_serialize) {
3690 if (!spin_trylock(&balancing)) 3692 if (!spin_trylock(&balancing))
3691 goto out; 3693 goto out;
3692 } 3694 }
@@ -3702,7 +3704,7 @@ static void rebalance_domains(int cpu, enum cpu_idle_type idle)
3702 } 3704 }
3703 sd->last_balance = jiffies; 3705 sd->last_balance = jiffies;
3704 } 3706 }
3705 if (sd->flags & SD_SERIALIZE) 3707 if (need_serialize)
3706 spin_unlock(&balancing); 3708 spin_unlock(&balancing);
3707out: 3709out:
3708 if (time_after(next_balance, sd->last_balance + interval)) { 3710 if (time_after(next_balance, sd->last_balance + interval)) {