Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 45b8775b authored by Olav Haugan's avatar Olav Haugan
Browse files

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: default avatarOlav Haugan <ohaugan@codeaurora.org>
parent c82e2f73
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -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;
		}