When calculate PE filter we need to use normalized capacity index and energy index to check if migration is fell into filter regions. So for cap_delta value, it directly generate out different from two capacity index based on before and after task's migration. Whatever the migrated task is a very small task or big task, they will have same cap_delta. On the other hand, the nrg_delta is calculated based on task utilization; so we can observe the range for cap_delta is much higher than the range for nrg_delta.
Let's think about one case, e.g. a task's util_avg=10; if there have other tasks are sharing scheduling with this task, and all tasks finally accumulated util_avg=1024 for 100% utilization. In this case, actually this task only can get benefit for performance with cap_delta as:
cap_delta * task(util_avg) / 1024;
The rest part for cap_delta will be consumed by other tasks on the CPU. So we can say this value is for this task's performance boosting in worst case.
On the other hand, we need to distinguish the task performance boosting affection for different CPU utilization. Usually the big load task with high utilization will have more prominent affection rather than low utilization task. So by discounting util_avg value, we can reflect for this affection.
Signed-off-by: Leo Yan leo.yan@linaro.org --- kernel/sched/fair.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 17dcd8e..661982f 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5096,6 +5096,16 @@ static inline int __energy_diff(struct energy_env *eenv) eenv->nrg.diff = eenv->nrg.after - eenv->nrg.before; eenv->payoff = 0;
+ /* + * The capacity index delta is meaningful for task with 100% + * utilization; If task will small utilization then we need + * discount the delta as the percentage between the task + * utilization with 100% (1024): + * cap.delta = cap.delta * task_util / 1024 + */ + eenv->cap.delta = + (eenv->cap.delta * eenv->util_delta) >> SCHED_CAPACITY_SHIFT; + trace_sched_energy_diff(eenv->task, eenv->src_cpu, eenv->dst_cpu, eenv->util_delta, eenv->nrg.before, eenv->nrg.after, eenv->nrg.diff, -- 1.9.1