sched: EAS: Fix the calculation of group util in group_idle_state()

util_delta becomes not zero in eenv_before, which will affect the
calculation of grp_util in group_idle_state(). Fix it under the
new condition.

Change-Id: Ic3853bb45876a8e388afcbe4e72d25fc42b1d7b0
Signed-off-by: Ke Wang <ke.wang@spreadtrum.com>
This commit is contained in:
Ke Wang 2017-11-01 16:07:38 +08:00 committed by Todd Kjos
parent 7d5a251c66
commit 47c87b2654

View file

@ -5429,13 +5429,6 @@ static int group_idle_state(struct energy_env *eenv, struct sched_group *sg)
/* Take non-cpuidle idling into account (active idle/arch_cpu_idle()) */
state++;
/*
* Try to estimate if a deeper idle state is
* achievable when we move the task.
*/
for_each_cpu(i, sched_group_cpus(sg))
grp_util += cpu_util(i);
src_in_grp = cpumask_test_cpu(eenv->src_cpu, sched_group_cpus(sg));
dst_in_grp = cpumask_test_cpu(eenv->dst_cpu, sched_group_cpus(sg));
if (src_in_grp == dst_in_grp) {
@ -5444,10 +5437,16 @@ static int group_idle_state(struct energy_env *eenv, struct sched_group *sg)
*/
goto end;
}
/* add or remove util as appropriate to indicate what group util
* will be (worst case - no concurrent execution) after moving the task
/*
* Try to estimate if a deeper idle state is
* achievable when we move the task.
*/
grp_util += src_in_grp ? -eenv->util_delta : eenv->util_delta;
for_each_cpu(i, sched_group_cpus(sg)) {
grp_util += cpu_util_wake(i, eenv->task);
if (unlikely(i == eenv->trg_cpu))
grp_util += eenv->util_delta;
}
if (grp_util <=
((long)sg->sgc->max_capacity * (int)sg->group_weight)) {