sched: ems: ontime: Use fit cpus when ontime task wake-up.
authorDaeyeong Lee <daeyeong.lee@samsung.com>
Fri, 18 May 2018 02:01:56 +0000 (11:01 +0900)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:24:55 +0000 (20:24 +0300)
Change-Id: I143735486cb003fea16d80144bb67ffaeb2bf01e
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
kernel/sched/ems/ontime.c

index 671d056ae9c92c6f209aa51b60751e6f26c780aa..2e30c831adaa3da5e9dfdce5d6bc0012d0992eee 100644 (file)
@@ -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;
 }