mirror of
https://github.com/torvalds/linux.git
synced 2026-07-31 11:37:06 +02:00
sched: walt: Fix stale walt CPU reservation flag
When CPU trying to move a task to other cpu in active load balance or by other means, then the other helping cpu marked as reserved to avoid it for other scheduler decisions. Once the task moved successfully, the reservation will be cleared enables for other scheduler decisions. The reserved flag is been analogously protected with busy cpu’s rq->active_balance, which is protected with runqueue locks. So whenever rq->active_balance is set for busy cpu, then reserved flag would set for helping cpu. Sometimes, it is observed that, cpu is marked as reserved with no cpu's rq->active_balance set. There are some unlikely possible corner cases may cause this behavior: - On active load balance path, cpu stop machine returns queued status of active_balance work on cpu_stopper, which is not checked on active balance path. so when stop machine is not able to queue ( unlikely), then reserved flag wouldn't be cleared. So, catch the return value and on failure, clear reserved flag for cpu. - Clear_walt_request() called on the cpu to clear any pending walt works, it may possible that, push_task might have changed or cleared, then the reserved cpu would be left uncleared. So clear the push_cpu independent of push_task. Change-Id: I75d032bf399cb3da8e807186b1bc903114168a4e Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org> Signed-off-by: Lingutla Chandrasekhar <clingutla@codeaurora.org> Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
This commit is contained in:
parent
7ba999c4e3
commit
71f5d6022e
|
|
@ -33,7 +33,7 @@ static void walt_attach_task(struct task_struct *p, struct rq *rq)
|
|||
check_preempt_curr(rq, p, 0);
|
||||
}
|
||||
|
||||
static int walt_lb_active_migration(void *data)
|
||||
static int stop_walt_lb_active_migration(void *data)
|
||||
{
|
||||
struct rq *busiest_rq = data;
|
||||
int busiest_cpu = cpu_of(busiest_rq);
|
||||
|
|
@ -307,10 +307,15 @@ static int walt_lb_pull_tasks(int dst_cpu, int src_cpu)
|
|||
* the push_task is really pulled onto this CPU.
|
||||
*/
|
||||
if (active_balance) {
|
||||
bool success;
|
||||
|
||||
wts = (struct walt_task_struct *) p->android_vendor_data1;
|
||||
trace_walt_active_load_balance(p, src_cpu, dst_cpu, wts);
|
||||
stop_one_cpu_nowait(src_cpu, walt_lb_active_migration,
|
||||
success = stop_one_cpu_nowait(src_cpu, stop_walt_lb_active_migration,
|
||||
src_rq, &src_rq->active_balance_work);
|
||||
if (!success)
|
||||
clear_reserved(dst_cpu);
|
||||
|
||||
return 0; /* we did not pull any task here */
|
||||
}
|
||||
|
||||
|
|
@ -543,7 +548,7 @@ void walt_lb_tick(struct rq *rq)
|
|||
|
||||
trace_walt_active_load_balance(p, prev_cpu, new_cpu, wts);
|
||||
ret = stop_one_cpu_nowait(prev_cpu,
|
||||
walt_lb_active_migration, rq,
|
||||
stop_walt_lb_active_migration, rq,
|
||||
&rq->active_balance_work);
|
||||
if (!ret)
|
||||
clear_reserved(new_cpu);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user