From: Daeyeong Lee Date: Fri, 18 May 2018 02:01:56 +0000 (+0900) Subject: sched: ems: ontime: Use fit cpus when ontime task wake-up. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3b7496b138c5d9e6236ae1b22d2ae365a0e98651;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git sched: ems: ontime: Use fit cpus when ontime task wake-up. Change-Id: I143735486cb003fea16d80144bb67ffaeb2bf01e Signed-off-by: Daeyeong Lee --- diff --git a/kernel/sched/ems/ontime.c b/kernel/sched/ems/ontime.c index 671d056ae9c9..2e30c831adaa 100644 --- a/kernel/sched/ems/ontime.c +++ b/kernel/sched/ems/ontime.c @@ -21,6 +21,7 @@ /* On-time migration */ /****************************************************************/ #define TASK_TRACK_COUNT 5 +#define MIN_CAPACITY_CPU 0 #define MAX_CAPACITY_CPU (NR_CPUS - 1) #define ontime_load_avg(p) (ontime_of(p)->avg.load_avg) @@ -478,56 +479,25 @@ void ontime_migration(void) int ontime_task_wakeup(struct task_struct *p) { - struct ontime_cond *curr, *next = NULL; - struct cpumask target_mask; - int src_cpu = task_cpu(p); - int dst_cpu = -1; + struct cpumask fit_cpus; + int dst_cpu, src_cpu = task_cpu(p); /* When wakeup task is on ontime migrating, do not ontime wakeup */ if (ontime_of(p)->migrating == 1) return -1; - if (ontime_load_avg(p) < get_down_threshold(src_cpu)) - goto release; - - /* - * When wakeup task satisfies ontime condition to up migration, - * check there is a possible target cpu. - */ - if (ontime_load_avg(p) >= get_up_threshold(src_cpu)) { - list_for_each_entry (curr, &cond_list, list) { - next = list_next_entry(curr, list); - if (cpumask_test_cpu(src_cpu, &curr->cpus)) { - cpumask_copy(&target_mask, &next->cpus); - break; - } - } - - dst_cpu = ontime_select_target_cpu(&target_mask, tsk_cpus_allowed(p)); - - if (cpu_selected(dst_cpu)) { - trace_ems_ontime_task_wakeup(p, src_cpu, dst_cpu, "up ontime"); - return dst_cpu; - } - } - - /* - * If there is a possible dst_cpu to stay, task will wake up at this cpu. - */ - cpumask_copy(&target_mask, cpu_coregroup_mask(src_cpu)); - dst_cpu = ontime_select_target_cpu(&target_mask, tsk_cpus_allowed(p)); + /* If fit_cpus is little coregroup, don't need to select dst_cpu */ + ontime_select_fit_cpus(p, &fit_cpus); + if (cpumask_test_cpu(MIN_CAPACITY_CPU, &fit_cpus)) + return -1; + dst_cpu = ontime_select_target_cpu(&fit_cpus, cpu_active_mask); if (cpu_selected(dst_cpu)) { - trace_ems_ontime_task_wakeup(p, src_cpu, dst_cpu, "stay ontime"); + trace_ems_ontime_task_wakeup(p, src_cpu, dst_cpu, "ontime wakeup"); return dst_cpu; } -release: - /* - * If wakeup task doesn't satisfy ontime condition or there is no - * possible dst_cpu, release this task from ontime - */ - trace_ems_ontime_task_wakeup(p, src_cpu, -1, "not ontime"); + trace_ems_ontime_task_wakeup(p, src_cpu, dst_cpu, "busy target"); return -1; }