sched/walt: Fix excess detach_task in walt_lb_pull_tasks

There's three loops to find a task to pull.

In the first iteration, we look for a task that is not running,
which fits a strict criteria.

In the second iteration, we look for a task that is not running,
which fits a lax criteria.

If we have still not found a valid task to pull, we intended to pull the
running task servicing an active load migration.

However, there is some leftover code, wherein a task that is not running
will end up being detached and pulled. This was not intended, and leads
to incorrect behavior. Essentially, this is negating the effects of the
first two iterations.

Change-Id: Ia225d89043c76ec6e661771a39d058498346920d
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
This commit is contained in:
Shaleen Agrawal 2022-06-15 15:30:11 -07:00 committed by Rishabh Bhatnagar
parent b18d15cb16
commit f41f3a4e0c

View File

@ -341,11 +341,9 @@ static int walt_lb_pull_tasks(int dst_cpu, int src_cpu)
list_for_each_entry_reverse(p, &src_rq->cfs_tasks, se.group_node) {
if (!cpumask_test_cpu(dst_cpu, p->cpus_ptr))
continue;
if (task_running(src_rq, p)) {
if (need_active_lb(p, dst_cpu, src_cpu)) {
if (cpumask_test_cpu(dst_cpu, p->cpus_ptr)
&& need_active_lb(p, dst_cpu, src_cpu)) {
bool success;
active_balance = true;
src_rq->active_balance = 1;
@ -371,12 +369,8 @@ static int walt_lb_pull_tasks(int dst_cpu, int src_cpu)
return 0; /* we did not pull any task here */
}
continue;
goto unlock;
}
walt_detach_task(p, src_rq, dst_rq);
pulled_task = p;
goto unlock;
}
unlock:
/* lock must be dropped before waking the stopper */