From 7f659033f3643fada4ac6f2bf89335aa3480e489 Mon Sep 17 00:00:00 2001 From: Johnlay Park Date: Fri, 6 Apr 2018 19:57:42 +0900 Subject: [PATCH] [COMMON] sched/rt: add the online cpu condition Change-Id: I32df8e8e32a09b4613108e99e8ad3cfaa5bfcd80 Signed-off-by: Johnlay Park --- kernel/sched/rt.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index e1e1abffc205..c227e11a6a01 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -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 */ -- 2.20.1