Skip to content

Commit 0dd512a

Browse files
Ke Wangpundiramit
authored andcommitted
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>
1 parent 4e8e7d6 commit 0dd512a

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

kernel/sched/fair.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5429,13 +5429,6 @@ static int group_idle_state(struct energy_env *eenv, struct sched_group *sg)
54295429
/* Take non-cpuidle idling into account (active idle/arch_cpu_idle()) */
54305430
state++;
54315431

5432-
/*
5433-
* Try to estimate if a deeper idle state is
5434-
* achievable when we move the task.
5435-
*/
5436-
for_each_cpu(i, sched_group_cpus(sg))
5437-
grp_util += cpu_util(i);
5438-
54395432
src_in_grp = cpumask_test_cpu(eenv->src_cpu, sched_group_cpus(sg));
54405433
dst_in_grp = cpumask_test_cpu(eenv->dst_cpu, sched_group_cpus(sg));
54415434
if (src_in_grp == dst_in_grp) {
@@ -5444,10 +5437,16 @@ static int group_idle_state(struct energy_env *eenv, struct sched_group *sg)
54445437
*/
54455438
goto end;
54465439
}
5447-
/* add or remove util as appropriate to indicate what group util
5448-
* will be (worst case - no concurrent execution) after moving the task
5440+
5441+
/*
5442+
* Try to estimate if a deeper idle state is
5443+
* achievable when we move the task.
54495444
*/
5450-
grp_util += src_in_grp ? -eenv->util_delta : eenv->util_delta;
5445+
for_each_cpu(i, sched_group_cpus(sg)) {
5446+
grp_util += cpu_util_wake(i, eenv->task);
5447+
if (unlikely(i == eenv->trg_cpu))
5448+
grp_util += eenv->util_delta;
5449+
}
54515450

54525451
if (grp_util <=
54535452
((long)sg->sgc->max_capacity * (int)sg->group_weight)) {

0 commit comments

Comments
 (0)