ems: frt: sync for latest
authorSangkyu Kim <skwith.kim@samsung.com>
Mon, 8 Oct 2018 11:18:04 +0000 (20:18 +0900)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:24:57 +0000 (20:24 +0300)
Change-Id: I6bfc7af78625019ad1e81823e257c11f4a124e11
Signed-off-by: Sangkyu Kim <skwith.kim@samsung.com>
kernel/sched/rt.c

index e6cdb453aeebe1d8e0d2fe76c4d504049f90efe7..08a0772bd9f95a03ca82c8334b0498dc8c9b6f08 100644 (file)
@@ -2694,8 +2694,8 @@ static int find_idle_cpu(struct task_struct *task, int wake_flags)
        if (unlikely(!dom))
                return best_cpu;
 
-       cpumask_and(&candidate_cpus, &task->cpus_allowed, cpu_active_mask);
        cpumask_and(&candidate_cpus, &candidate_cpus, get_activated_cpus());
+       cpumask_and(&candidate_cpus, &task->cpus_allowed, cpu_active_mask);
        if (unlikely(cpumask_empty(&candidate_cpus)))
                cpumask_copy(&candidate_cpus, &task->cpus_allowed);
 
@@ -2708,6 +2708,9 @@ static int find_idle_cpu(struct task_struct *task, int wake_flags)
                                continue;
 
                        cpu_load = frt_cpu_util_wake(cpu, task) + task_util(task);
+                       if (cpu_load > capacity_orig_of(cpu))
+                               continue;
+
                        if ((cpu_prio > max_prio) || (cpu_load < min_load) ||
                                        (cpu_load == min_load && task_cpu(task) == cpu)) {
                                min_load = cpu_load;
@@ -2733,8 +2736,8 @@ static int find_idle_cpu(struct task_struct *task, int wake_flags)
 static int find_recessive_cpu(struct task_struct *task, int wake_flags)
 {
        int cpu, best_cpu = -1;
+       u64 cpu_load, min_load = ULLONG_MAX;
        struct cpumask *lowest_mask;
-       u64 cpu_load = ULLONG_MAX, min_load = ULLONG_MAX;
        struct cpumask candidate_cpus;
        struct frt_dom *dom, *prefer_dom;
 
@@ -2758,6 +2761,9 @@ static int find_recessive_cpu(struct task_struct *task, int wake_flags)
                for_each_cpu_and(cpu, &dom->cpus, &candidate_cpus) {
                        cpu_load = frt_cpu_util_wake(cpu, task) + task_util(task);
 
+                       if (cpu_load > capacity_orig_of(cpu))
+                               continue;
+
                        if (cpu_load < min_load ||
                                (cpu_load == min_load && task_cpu(task) == cpu)) {
                                min_load = cpu_load;