Current code has one possible path to directly migrate task from lower capacity CPU to higher capacity CPU in waken up balance: function task_fits_max() return false and the previous CPU is over-utilized. So it is hard for tasks to migrate to higher capacity CPU.
This patch add the path to directly migrate task from lower capacity CPU (LITTLE core) to higher capacity CPU (big core) if find lower capacity CPU cannot meet performance requirement. In this path, it leave PE filter to decide if can migrate task after set task boost margin.
Signed-off-by: Leo Yan leo.yan@linaro.org --- kernel/sched/fair.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 54d80908..71f020d 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5741,6 +5741,19 @@ static int energy_aware_wake_cpu(struct task_struct *p, int target) if (target_cpu == -1) return task_cpu(p);
+ /* + * Destination CPU has higher capacity than previous CPU, + * so that means pervious CPU has no enough capacity to meet + * the waken up task. Therefore directly return back and select + * destination CPU. + * + * If has set boost margin for this task, then leave to PE filter + * to decide if can migrate task. + */ + if (capacity_of(target_cpu) > capacity_of(task_cpu(p)) && + !schedtune_task_margin(p)) + return target_cpu; + if (target_cpu != task_cpu(p)) { struct energy_env eenv = { .util_delta = task_util(p), -- 1.9.1