aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
authorGautham R Shenoy <ego@in.ibm.com>2009-04-14 00:55:35 -0400
committerIngo Molnar <mingo@elte.hu>2009-04-14 05:49:19 -0400
commite790fb0ba64bfec158e1219d899cb588275d12ab (patch)
treef4eda89681e027cd617881773ab0559d9fced430 /kernel/sched.c
parentf711f6090a81cbd396b63de90f415d33f563af9b (diff)
sched: Nominate a power-efficient ilb in select_nohz_balancer()
The CPU that first goes idle becomes the idle-load-balancer and remains that until either it picks up a task or till all the CPUs of the system goes idle. Optimize this further to allow it to relinquish it's post once all it's siblings in the power-aware sched_domain go idle, thereby allowing the whole package-core to go idle. While relinquising the post, nominate another an idle-load balancer from a semi-idle core/package. Signed-off-by: Gautham R Shenoy <ego@in.ibm.com> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl> LKML-Reference: <20090414045535.7645.31641.stgit@sofia.in.ibm.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index b0fefa300b40..36d213bca473 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4414,8 +4414,24 @@ int select_nohz_load_balancer(int stop_tick)
4414 /* make me the ilb owner */ 4414 /* make me the ilb owner */
4415 if (atomic_cmpxchg(&nohz.load_balancer, -1, cpu) == -1) 4415 if (atomic_cmpxchg(&nohz.load_balancer, -1, cpu) == -1)
4416 return 1; 4416 return 1;
4417 } else if (atomic_read(&nohz.load_balancer) == cpu) 4417 } else if (atomic_read(&nohz.load_balancer) == cpu) {
4418 int new_ilb;
4419
4420 if (!(sched_smt_power_savings ||
4421 sched_mc_power_savings))
4422 return 1;
4423 /*
4424 * Check to see if there is a more power-efficient
4425 * ilb.
4426 */
4427 new_ilb = find_new_ilb(cpu);
4428 if (new_ilb < nr_cpu_ids && new_ilb != cpu) {
4429 atomic_set(&nohz.load_balancer, -1);
4430 resched_cpu(new_ilb);
4431 return 0;
4432 }
4418 return 1; 4433 return 1;
4434 }
4419 } else { 4435 } else {
4420 if (!cpumask_test_cpu(cpu, nohz.cpu_mask)) 4436 if (!cpumask_test_cpu(cpu, nohz.cpu_mask))
4421 return 0; 4437 return 0;