aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 0a4a26b21f69..2b2b780939c9 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2880,6 +2880,7 @@ static void update_load(struct rq *this_rq)
2880 * 2880 *
2881 * Balancing parameters are set up in arch_init_sched_domains. 2881 * Balancing parameters are set up in arch_init_sched_domains.
2882 */ 2882 */
2883static DEFINE_SPINLOCK(balancing);
2883 2884
2884static void run_rebalance_domains(struct softirq_action *h) 2885static void run_rebalance_domains(struct softirq_action *h)
2885{ 2886{
@@ -2909,6 +2910,11 @@ static void run_rebalance_domains(struct softirq_action *h)
2909 if (unlikely(!interval)) 2910 if (unlikely(!interval))
2910 interval = 1; 2911 interval = 1;
2911 2912
2913 if (sd->flags & SD_SERIALIZE) {
2914 if (!spin_trylock(&balancing))
2915 goto out;
2916 }
2917
2912 if (time_after_eq(jiffies, sd->last_balance + interval)) { 2918 if (time_after_eq(jiffies, sd->last_balance + interval)) {
2913 if (load_balance(this_cpu, this_rq, sd, idle)) { 2919 if (load_balance(this_cpu, this_rq, sd, idle)) {
2914 /* 2920 /*
@@ -2920,6 +2926,9 @@ static void run_rebalance_domains(struct softirq_action *h)
2920 } 2926 }
2921 sd->last_balance = jiffies; 2927 sd->last_balance = jiffies;
2922 } 2928 }
2929 if (sd->flags & SD_SERIALIZE)
2930 spin_unlock(&balancing);
2931out:
2923 if (time_after(next_balance, sd->last_balance + interval)) 2932 if (time_after(next_balance, sd->last_balance + interval))
2924 next_balance = sd->last_balance + interval; 2933 next_balance = sd->last_balance + interval;
2925 } 2934 }