summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlav Haugan <ohaugan@codeaurora.org>2016-11-08 17:06:21 -0800
committerOlav Haugan <ohaugan@codeaurora.org>2016-11-10 14:19:05 -0800
commit45b8775b62bb27f5e88b07c17f45dd9ab0cf9bd9 (patch)
tree846a9a86577b2717723490ba8960bed405480009
parentc82e2f73d1028cd1ff2d6b767ea656909888e516 (diff)
sched/core: Fix migrate tasks bail-out condition
Migrate tasks function is used by both hotplug and cpu isolation. During hotplug all the cpus are stalled (in stop machine) while tasks are being migrated. However, this is not the case during cpu isolation. A task that was counted as a pinned thread might have been migrated off the cpu. Take this into account when checking whether we have completed moving all tasks off the runqueue. Also ignore warning about tasks moving off the run-queue for isolation use case. Change-Id: I5c5f25eb9b1eaf0605b606a65e0ac86996fa5f27 Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
-rw-r--r--kernel/sched/core.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index e7196c3a3457..862eb8fd3860 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5497,7 +5497,7 @@ static void migrate_tasks(struct rq *dead_rq, bool migrate_pinned_tasks)
*/
if ((migrate_pinned_tasks && rq->nr_running == 1) ||
(!migrate_pinned_tasks &&
- rq->nr_running == num_pinned_kthreads))
+ rq->nr_running <= num_pinned_kthreads))
break;
/*
@@ -5533,8 +5533,12 @@ static void migrate_tasks(struct rq *dead_rq, bool migrate_pinned_tasks)
* Since we're inside stop-machine, _nothing_ should have
* changed the task, WARN if weird stuff happened, because in
* that case the above rq->lock drop is a fail too.
+ * However, during cpu isolation the load balancer might have
+ * interferred since we don't stop all CPUs. Ignore warning for
+ * this case.
*/
- if (WARN_ON(task_rq(next) != rq || !task_on_rq_queued(next))) {
+ if (WARN_ON((task_rq(next) != rq || !task_on_rq_queued(next)) &&
+ migrate_pinned_tasks)) {
raw_spin_unlock(&next->pi_lock);
continue;
}