sched/walt: Prevent active migration of pipeline task during newidle

balance

If a pipeline task is the last task on a cpu and it sleeps, then during
newidle balance don't pull any other pipeline task on that cpu. If we
allow this, we will end up with two pipeline tasks on the same cpu in
the following series of events:
1. Task1 is about to sleep on a cpu7.
2. Task2 is selected to be pulled from another cpu. So, migration thread
   is scheduled to pull this task.
3. Task1 wakeup up again on cpu7 before migration of Task2 completes.
4. Task2 migrates to cpu7.

Thus we end up having Task1 and Task2 on cpu7.

Change-Id: I7b1430ebb565a21358995849b33a30af32ac1e4b
Signed-off-by: Atul Pant <quic_atulpant@quicinc.com>
This commit is contained in:
Atul Pant 2024-06-19 15:17:41 +05:30
parent 08f3514ce1
commit ab41af2f79

View File

@ -287,6 +287,17 @@ static inline bool need_active_lb(struct task_struct *p, int dst_cpu,
if (task_reject_partialhalt_cpu(p, dst_cpu))
return false;
/*
* If the sleeping task on the dst_cpu and the task for which we are
* doing active load balance, are pipeline tasks then don't do active
* load balance. If we allow this, the sleeping task might wakeup
* again on dst_cpu before the migration of actively pulled task. This
* will result in two pipeline tasks on the same cpu
*/
if (walt_pipeline_low_latency_task(p) &&
walt_pipeline_low_latency_task(cpu_rq(dst_cpu)->curr))
return false;
return true;
}