summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorOlav Haugan <ohaugan@codeaurora.org>2014-07-22 15:45:14 -0700
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 19:59:57 -0700
commit75166225073f9bfaefdc740c5c4fe2064cb33c77 (patch)
treefc90d27a527d209a1ae5a6a58889418777364a83 /kernel
parentb32244628fe20dde5b5175dc4dbc6c562d09df77 (diff)
sched/fair: Check whether any CPUs are available
There is a possibility that there are no allowed CPUs online when we try to select the best cpu for a small task. Add a check to ensure we don't continue if there are no CPUs available. CRs-fixed: 692505 Change-Id: Iff955fb0d0b07e758a893539f7bc8ea8aa09d9c4 Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched/fair.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 14904696fc63..36c996bfb844 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -2947,6 +2947,9 @@ static int best_small_task_cpu(struct task_struct *p)
cpumask_and(&search_cpus, tsk_cpus_allowed(p), cpu_online_mask);
+ if (cpumask_empty(&search_cpus))
+ return task_cpu(p);
+
/* Take a first pass to find the lowest power cost CPU. This
will avoid a potential O(n^2) search */
for_each_cpu(i, &search_cpus) {