When use WALT signals the task is more easily to migrate from little core to big core and will introduce quite high power consumption for some scenarios.
This patch is to add extra checking for WALT signals, if the task util_avg is less than 1/4 of CPU capacity, even the task WALT signal is a quite high value still don't migrate task to higher capacity CPU. This is because WALT is accounting both running and runnable time for task, even a small task still may have high WALT value. So we need use util_avg to filter out which tasks are real big load tasks.
Signed-off-by: Leo Yan leo.yan@linaro.org --- kernel/sched/fair.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 80c5a91..11d438b 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5391,9 +5391,17 @@ static bool need_filter_task(struct task_struct *p) do { int first_cpu = group_first_cpu(sg);
- if (capacity_orig_of(first_cpu) < target_max_cap && - task_util(p) * 4 < capacity_orig_of(first_cpu)) - target_max_cap = capacity_orig_of(first_cpu); + if (capacity_orig_of(first_cpu) >= target_max_cap) + continue; + + if (sysctl_sched_use_walt_task_util) { + if (task_fits_max(p, first_cpu) || + p->se.avg.util_avg * 4 < capacity_orig_of(first_cpu)) + target_max_cap = capacity_orig_of(first_cpu); + } else { + if (task_util(p) * 4 < capacity_orig_of(first_cpu)) + target_max_cap = capacity_orig_of(first_cpu); + }
} while (sg = sg->next, sg != sd->groups);
@@ -6747,8 +6755,15 @@ int can_migrate_task(struct task_struct *p, struct lb_env *env) 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 (sysctl_sched_use_walt_task_util) { + if (task_fits_max(p, env->src_cpu) || + p->se.avg.util_avg * 4 < capacity_orig_of(env->src_cpu)) + return 0; + + } else { + if (task_util(p) * 4 < capacity_orig_of(env->src_cpu)) + return 0; + }
if (cpu_overutilized(env->dst_cpu) && !idle_cpu(env->dst_cpu)) -- 1.9.1