diff options
author | Christoph Lameter <clameter@sgi.com> | 2006-12-10 05:20:29 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-10 12:55:43 -0500 |
commit | 08c183f31bdbb709f177f6d3110d5f288ea33933 (patch) | |
tree | be7b84c07f3b0bf29473bad2b7b788fa189f948e /kernel | |
parent | 1bd77f2da58e9cdd1f159217887343dadd9af417 (diff) |
[PATCH] sched: add option to serialize load balancing
Large sched domains can be very expensive to scan. Add an option SD_SERIALIZE
to the sched domain flags. If that flag is set then we make sure that no
other such domain is being balanced.
[akpm@osdl.org: build fix]
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Cc: Peter Williams <pwil3058@bigpond.net.au>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: Christoph Lameter <clameter@sgi.com>
Cc: "Siddha, Suresh B" <suresh.b.siddha@intel.com>
Cc: "Chen, Kenneth W" <kenneth.w.chen@intel.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/sched.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 0a4a26b21f6..2b2b780939c 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 | */ |
2883 | static DEFINE_SPINLOCK(balancing); | ||
2883 | 2884 | ||
2884 | static void run_rebalance_domains(struct softirq_action *h) | 2885 | static 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); | ||
2931 | out: | ||
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 | } |