In energy aware path for waken task, it calculates energy difference to select power saving CPU. For some corner case, the task utilization is 0, this means the task has run very short time and don't cross 1024us (1ms). At the end energy difference = 0 when task utilized is 0, so finally select an unexpected target CPU for below scenario:
If the task previously run on CPUA and CPUA is a higher capacity CPU, when calculate energy difference between CPUA with another lower capacity CPU (CPUB), we will get energy_diff = 0. Finally this task sticks on CPUA and miss the chance to migrate to CPUB.
If the energy difference calculation happens between two CPUs with same capacity, it will always stay on previous CPU so the calculation is pointless.
This patch checks if the task util_avg is 0, it directly returns back 'target_cpu' which is selected by the power efficiency loop.
Signed-off-by: Leo Yan leo.yan@linaro.org --- kernel/sched/fair.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index d1d5dad..7b1f65b 100755 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5616,6 +5616,9 @@ static int energy_aware_wake_cpu(struct task_struct *p, int target, int sync) } }
+ if (unlikely(!task_util(p))) + return target_cpu; + if (target_cpu != task_cpu(p)) { struct energy_env eenv = { .util_delta = task_util(p), -- 2.7.4
Hi Leo,
Might be good to say on which EAS version this patch applies because I can't find any energy_aware_wake_cpu() in the lastest EAS version
On 22 December 2016 at 16:24, Leo Yan leo.yan@linaro.org wrote:
In energy aware path for waken task, it calculates energy difference to select power saving CPU. For some corner case, the task utilization is 0, this means the task has run very short time and don't cross 1024us (1ms). At the end energy difference = 0 when task utilized is 0, so finally select an unexpected target CPU for below scenario:
If the task previously run on CPUA and CPUA is a higher capacity CPU, when calculate energy difference between CPUA with another lower capacity CPU (CPUB), we will get energy_diff = 0. Finally this task sticks on CPUA and miss the chance to migrate to CPUB.
If the energy difference calculation happens between two CPUs with same capacity, it will always stay on previous CPU so the calculation is pointless.
This patch checks if the task util_avg is 0, it directly returns back 'target_cpu' which is selected by the power efficiency loop.
Signed-off-by: Leo Yan leo.yan@linaro.org
kernel/sched/fair.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index d1d5dad..7b1f65b 100755 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5616,6 +5616,9 @@ static int energy_aware_wake_cpu(struct task_struct *p, int target, int sync) } }
if (unlikely(!task_util(p)))
return target_cpu;
if (target_cpu != task_cpu(p)) { struct energy_env eenv = { .util_delta = task_util(p),
-- 2.7.4
On Thu, Dec 22, 2016 at 05:12:13PM +0100, Vincent Guittot wrote:
Hi Leo,
Might be good to say on which EAS version this patch applies because I can't find any energy_aware_wake_cpu() in the lastest EAS version
Thanks reminding. This patch and later patch series for misfit related improvement are still stick on EASv5.2.
I quite suspect this patch can be applied to latest EAS version, but I think latest EAS code also need handle this case.
On 22 December 2016 at 16:24, Leo Yan leo.yan@linaro.org wrote:
In energy aware path for waken task, it calculates energy difference to select power saving CPU. For some corner case, the task utilization is 0, this means the task has run very short time and don't cross 1024us (1ms). At the end energy difference = 0 when task utilized is 0, so finally select an unexpected target CPU for below scenario:
If the task previously run on CPUA and CPUA is a higher capacity CPU, when calculate energy difference between CPUA with another lower capacity CPU (CPUB), we will get energy_diff = 0. Finally this task sticks on CPUA and miss the chance to migrate to CPUB.
If the energy difference calculation happens between two CPUs with same capacity, it will always stay on previous CPU so the calculation is pointless.
This patch checks if the task util_avg is 0, it directly returns back 'target_cpu' which is selected by the power efficiency loop.
Signed-off-by: Leo Yan leo.yan@linaro.org
kernel/sched/fair.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index d1d5dad..7b1f65b 100755 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5616,6 +5616,9 @@ static int energy_aware_wake_cpu(struct task_struct *p, int target, int sync) } }
if (unlikely(!task_util(p)))
return target_cpu;
if (target_cpu != task_cpu(p)) { struct energy_env eenv = { .util_delta = task_util(p),
-- 2.7.4