[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)
committerChungwoo Park <cww.park@samsung.com>
Mon, 21 May 2018 08:35:39 +0000 (17:35 +0900)
Change-Id: I32df8e8e32a09b4613108e99e8ad3cfaa5bfcd80
Signed-off-by: Johnlay Park <jonglae.park@samsung.com>
kernel/sched/rt.c

index 7fd21086e7250cdabca0f7c72dd75d184a335634..45c8809daf8ac2a61562e3715a695f5867bdb214 100644 (file)
@@ -2322,7 +2322,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;
@@ -2417,6 +2418,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 */