[COMMON] sched: ems: Modify ontime_can_migration condition
authorDaeyeong Lee <daeyeong.lee@samsung.com>
Mon, 3 Sep 2018 06:18:48 +0000 (15:18 +0900)
committerhskang <hs1218.kang@samsung.com>
Sun, 9 Sep 2018 21:38:02 +0000 (06:38 +0900)
Change-Id: I8e4c0fd4843fd5b84f6a8d1340b11f7f1a1b800b
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
kernel/sched/ems/ontime.c

index 37f2cf1f9ba5c5e12ba161a1874b78173c61cd86..1547825de2644c1cbf9b28c18c9304a782c1e95f 100644 (file)
@@ -643,31 +643,19 @@ int ontime_can_migration(struct task_struct *p, int dst_cpu)
        }
 
        /*
-        * When runqueue is busy, check whether this task is heaviest.
-        * If this task is not heaviest in runqueue, allow it to be migrated.
+        * When runqueue is overloaded, check whether cpu's util exceed coverage ratio.
+        * If so, allow the task to be migrated.
         */
        if (cpu_rq(src_cpu)->nr_running > 1) {
-               struct task_struct *curr = cpu_curr(src_cpu);
-               struct sched_entity *se = __pick_first_entity(p->se.cfs_rq);
-               int count;
+               unsigned long cpu_util = cpu_util_wake(src_cpu, p);
+               unsigned long util = task_util(p);
+               unsigned long coverage_ratio = get_coverage_ratio(src_cpu);
 
-               /* Firstly, compare with curr running task */
-               if (ontime_load_avg(p) < ontime_load_avg(curr)) {
-                       trace_ems_ontime_check_migrate(p, dst_cpu, true, "busy runqueue");
+               if ((cpu_util * 100 >= capacity_orig_of(src_cpu) * coverage_ratio)
+                               && (cpu_util > util)) {
+                       trace_ems_ontime_check_migrate(p, dst_cpu, true, "exceed coverage");
                        return true;
                }
-
-               /* Secondly, compare with tasks in rq */
-               for (count = 0; se && count < TASK_TRACK_COUNT;
-                               se = __pick_next_entity(se), count++) {
-                       if (entity_is_cfs_rq(se))
-                               continue;
-
-                       if (ontime_load_avg(p) < ontime_load_avg(task_of(se))) {
-                               trace_ems_ontime_check_migrate(p, dst_cpu, true, "busy runqueue");
-                               return true;
-                       }
-               }
        }
 
        trace_ems_ontime_check_migrate(p, dst_cpu, false, "heavy task");