[COMMON] sched/rt: add the online cpu condition
authorJohnlay Park <jonglae.park@samsung.com>
Fri, 6 Apr 2018 10:57:42 +0000 (19:57 +0900)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:24:55 +0000 (20:24 +0300)
Change-Id: I32df8e8e32a09b4613108e99e8ad3cfaa5bfcd80
Signed-off-by: Johnlay Park <jonglae.park@samsung.com>
kernel/sched/rt.c

index e1e1abffc20586892b6d05fb7e5e8980707f681c..c227e11a6a012d5bba4dd6ea9171bab29c1dd3f0 100644 (file)
@@ -2340,7 +2340,8 @@ static int find_lowest_rq_fluid(struct task_struct *task, int wake_flags)
         * 1. Cache hot : packing the callee and caller,
         *      when there is nothing to run except callee
         */
-       if (wake_flags || affordable_cpu(prefer_cpu, task_util(task))) {
+       if ((wake_flags || affordable_cpu(prefer_cpu, task_util(task))) &&
+               cpumask_test_cpu(prefer_cpu, cpu_online_mask)) {
                best_cpu = prefer_cpu;
                trace_sched_fluid_stat(task, &task->se.avg, best_cpu, "CACHE-HOT");
                goto out;
@@ -2435,6 +2436,10 @@ static int find_lowest_rq_fluid(struct task_struct *task, int wake_flags)
 unlock:
        rcu_read_unlock();
 out:
+
+       if (!cpumask_test_cpu(best_cpu, cpu_online_mask))
+               best_cpu = -1;
+
        return best_cpu;
 }
 #endif /* CONFIG_SCHED_USE_FLUID_RT */