EAS defines “if any CPU is over-utilized” as tipping point criteria, after meet this criteria EAS takes system as over tipping point and go back to SMP load balance. So SMP load balance may migrate small task onto big core but usually we are only looking forward big tasks migration, finally this hurts both power and performance
This patch is to add more checking in function can_migrate_task to avoid migrate small task to higher capacity CPU: if the task's utilization is more than 1/4 of CPU's capacity, then consider this task is a small task and don't need migrate to big core; if the destination CPU is already over-utilized by other big cores, then it's not need migrate the task to the big core due it's pointless.
Signed-off-by: Leo Yan leo.yan@linaro.org --- kernel/sched/fair.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 2c9abc3..5d845c2 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6665,11 +6665,25 @@ int can_migrate_task(struct task_struct *p, struct lb_env *env)
/* * We do not migrate tasks that are: - * 1) throttled_lb_pair, or - * 2) cannot be migrated to this CPU due to cpus_allowed, or - * 3) running (obviously), or - * 4) are cache-hot on their current CPU. + * 1) energy_aware is enabled and small task is not migrated to higher + * capacity CPU + * 2) throttled_lb_pair, or + * 3) cannot be migrated to this CPU due to cpus_allowed, or + * 4) running (obviously), or + * 5) are cache-hot on their current CPU. */ + + if (energy_aware() && + (capacity_orig_of(env->dst_cpu) > capacity_orig_of(env->src_cpu))) { + + if (task_util(p) * 4 < capacity_orig_of(env->src_cpu)) + return 0; + + if (cpu_overutilized(env->dst_cpu) && + !idle_cpu(env->dst_cpu)) + return 0; + } + if (throttled_lb_pair(task_group(p), env->src_cpu, env->dst_cpu)) return 0;
-- 1.9.1