Commit 977dda7c authored by Paul Turner's avatar Paul Turner Committed by Ingo Molnar

sched: Update effective_load() to use global share weights

Previously effective_load would approximate the global load weight present on
a group taking advantage of:

entity_weight = tg->shares ( lw / global_lw ), where entity_weight was provided
by tg_shares_up.

This worked (approximately) for an 'empty' (at tg level) cpu since we would
place boost load representative of what a newly woken task would receive.

However, now that load is instantaneously updated this assumption is no longer
true and the load calculation is rather incorrect in this case.

Fix this (and improve the general case) by re-writing effective_load to take
advantage of the new shares distribution code.
Signed-off-by: default avatarPaul Turner <pjt@google.com>
Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <20110115015817.069769529@google.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent c9b5f501
...@@ -1362,27 +1362,27 @@ static long effective_load(struct task_group *tg, int cpu, long wl, long wg) ...@@ -1362,27 +1362,27 @@ static long effective_load(struct task_group *tg, int cpu, long wl, long wg)
return wl; return wl;
for_each_sched_entity(se) { for_each_sched_entity(se) {
long S, rw, s, a, b; long lw, w;
S = se->my_q->tg->shares; tg = se->my_q->tg;
s = se->load.weight; w = se->my_q->load.weight;
rw = se->my_q->load.weight;
a = S*(rw + wl); /* use this cpu's instantaneous contribution */
b = S*rw + s*wg; lw = atomic_read(&tg->load_weight);
lw -= se->my_q->load_contribution;
lw += w + wg;
wl = s*(a-b); wl += w;
if (likely(b)) if (lw > 0 && wl < lw)
wl /= b; wl = (wl * tg->shares) / lw;
else
wl = tg->shares;
/* /* zero point is MIN_SHARES */
* Assume the group is already running and will if (wl < MIN_SHARES)
* thus already be accounted for in the weight. wl = MIN_SHARES;
* wl -= se->load.weight;
* That is, moving shares between CPUs, does not
* alter the group weight.
*/
wg = 0; wg = 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment