diff options
| author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2009-10-22 18:07:59 +0530 |
|---|---|---|
| committer | Thomas Gleixner <tglx@linutronix.de> | 2009-10-29 09:08:26 +0100 |
| commit | 1e2ea8a1c5fbcfea1ea85cf2c33475f08ed2c46c (patch) | |
| tree | e5c5caa5f232987091e2ed5978e17b3b60f153c9 /kernel | |
| parent | cddfcb89afe2840f8a2f002a2bb00f42e1526eaf (diff) | |
| download | lwn-1e2ea8a1c5fbcfea1ea85cf2c33475f08ed2c46c.tar.gz lwn-1e2ea8a1c5fbcfea1ea85cf2c33475f08ed2c46c.zip | |
sched: Deal with low-load in wake_affine()
wake_affine() would always fail under low-load situations where
both prev and this were idle, because adding a single task will
always be a significant imbalance, even if there's nothing
around that could balance it.
Deal with this by allowing imbalance when there's nothing you
can do about it.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Dinakar Guniguntala <dino@in.ibm.com>
Cc: John Stultz <johnstul@us.ibm.com>
Cc: Darren Hart <dvhltc@us.ibm.com>
Cc: John Kacur <jkacur@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/sched_fair.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c index d95a4b97b4a3..e5945df78e8a 100644 --- a/kernel/sched_fair.c +++ b/kernel/sched_fair.c @@ -1264,7 +1264,17 @@ wake_affine(struct sched_domain *this_sd, struct rq *this_rq, tg = task_group(p); weight = p->se.load.weight; - balanced = 100*(tl + effective_load(tg, this_cpu, weight, weight)) <= + /* + * In low-load situations, where prev_cpu is idle and this_cpu is idle + * due to the sync cause above having dropped tl to 0, we'll always have + * an imbalance, but there's really nothing you can do about that, so + * that's good too. + * + * Otherwise check if either cpus are near enough in load to allow this + * task to be woken on this_cpu. + */ + balanced = !tl || + 100*(tl + effective_load(tg, this_cpu, weight, weight)) <= imbalance*(load + effective_load(tg, prev_cpu, 0, weight)); /* |
