diff options
author | Siddha, Suresh B <suresh.b.siddha@intel.com> | 2007-05-08 09:33:01 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-08 20:15:17 +0200 |
commit | 4953198b6ce07b008b0f1c2edd41c9d027a118b4 (patch) | |
tree | dc0f500aae58c84ee7d422ac11990956ecbf9673 /kernel/sched.c | |
parent | Speed up divides by cpu_power in scheduler (diff) | |
download | linux-4953198b6ce07b008b0f1c2edd41c9d027a118b4.tar.xz linux-4953198b6ce07b008b0f1c2edd41c9d027a118b4.zip |
sched: optimize siblings status check logic in wake_idle()
When a logical cpu 'x' already has more than one process running, then most
likely the siblings of that cpu 'x' must be busy. Otherwise the idle
siblings would have likely(in most of the scenarios) picked up the extra
load making the load on 'x' atmost one.
Use this logic to eliminate the siblings status check and minimize the cache
misses encountered on a heavily loaded system.
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r-- | kernel/sched.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index e4a5888549a5..e60786eb731c 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -1406,7 +1406,16 @@ static int wake_idle(int cpu, struct task_struct *p) struct sched_domain *sd; int i; - if (idle_cpu(cpu)) + /* + * If it is idle, then it is the best cpu to run this task. + * + * This cpu is also the best, if it has more than one task already. + * Siblings must be also busy(in most cases) as they didn't already + * pickup the extra load from this cpu and hence we need not check + * sibling runqueue info. This will avoid the checks and cache miss + * penalities associated with that. + */ + if (idle_cpu(cpu) || cpu_rq(cpu)->nr_running > 1) return cpu; for_each_domain(cpu, sd) { |