When calculation energy difference before and after task placement on specific CPU, the idle state selection sometimes is based on the idle state index and sometimes based on the utilization to estimation. So the different idle state selections even happens on same one CPU, and the idle state estimation code is totally different with current CPU idle governor.
Avoid to introduce big deviation for energy calculation, let's remove the idle state estimation.
Change-Id: I4de0df9ce8f4e425206bd14de7c8069b488c4483 Signed-off-by: Leo Yan leo.yan@linaro.org --- kernel/sched/fair.c | 49 ------------------------------------------------- 1 file changed, 49 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index b834fb3..4e43c9a 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5609,8 +5609,6 @@ static int group_idle_state(struct energy_env *eenv, int cpu_id) { struct sched_group *sg = eenv->sg; int i, state = INT_MAX; - int src_in_grp, dst_in_grp; - long grp_util = 0;
/* Find the shallowest idle state in the sched group. */ for_each_cpu(i, sched_group_cpus(sg)) @@ -5619,53 +5617,6 @@ static int group_idle_state(struct energy_env *eenv, int cpu_id) /* Take non-cpuidle idling into account (active idle/arch_cpu_idle()) */ state++;
- src_in_grp = cpumask_test_cpu(eenv->prev_cpu, sched_group_cpus(sg)); - dst_in_grp = cpumask_test_cpu(cpu_id, sched_group_cpus(sg)); - if (src_in_grp == dst_in_grp) { - /* both CPUs under consideration are in the same group or not in - * either group, migration should leave idle state the same. - */ - goto end; - } - - /* - * 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_wake(i, eenv->p); - if (unlikely(i == cpu_id)) - grp_util += eenv->util_delta; - } - - if (grp_util <= - ((long)sg->sgc->max_capacity * (int)sg->group_weight)) { - /* after moving, this group is at most partly - * occupied, so it should have some idle time. - */ - int max_idle_state_idx = sg->sge->nr_idle_states - 2; - int new_state = grp_util * max_idle_state_idx; - if (grp_util <= 0) - /* group will have no util, use lowest state */ - new_state = max_idle_state_idx + 1; - else { - /* for partially idle, linearly map util to idle - * states, excluding the lowest one. This does not - * correspond to the state we expect to enter in - * reality, but an indication of what might happen. - */ - new_state = min(max_idle_state_idx, (int) - (new_state / sg->sgc->max_capacity)); - new_state = max_idle_state_idx - new_state; - } - state = new_state; - } else { - /* After moving, the group will be fully occupied - * so assume it will not be idle at all. - */ - state = 0; - } -end: return state; }
-- 1.9.1