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

Commit 1a993968 authored by Olav Haugan's avatar Olav Haugan Committed by Gerrit - the friendly Code Review server
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: I505076e4723b9d18f70be634c11b7e6fdbaa556c
Signed-off-by: default avatarOlav Haugan <ohaugan@codeaurora.org>
Signed-off-by: default avatarSatya Durga Srinivasu Prabhala <satyap@codeaurora.org>
parent 78af2bab
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -5618,7 +5618,7 @@ static void migrate_tasks(struct rq *dead_rq, struct rq_flags *rf,
		 */
		if ((migrate_pinned_tasks && rq->nr_running == 1) ||
		   (!migrate_pinned_tasks &&
		    rq->nr_running == num_pinned_kthreads))
		    rq->nr_running <= num_pinned_kthreads))
			break;

		/*
@@ -5652,8 +5652,12 @@ static void migrate_tasks(struct rq *dead_rq, struct rq_flags *rf,
		 * 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;
		}