sched/walt: Fix locking issue in MVP tasks update

Protect MVP tasks list access in the tick path with rq lock.

Change-Id: I387aa104cbacaf445bf739b8fb6d631283bd0ada
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
This commit is contained in:
Pavankumar Kondeti 2021-05-27 07:14:06 +05:30 committed by Rishabh Bhatnagar
parent 8bbd8002ed
commit 5a4738726d

View File

@ -828,6 +828,8 @@ static void walt_cfs_account_mvp_runtime(struct rq *rq, struct task_struct *curr
s64 delta;
unsigned int limit;
lockdep_assert_held(&rq->lock);
/* sum_exec_snapshot can be ahead. See below increment */
delta = curr->se.sum_exec_runtime - wts->sum_exec_snapshot;
if (delta < 0)
@ -905,8 +907,10 @@ void walt_cfs_tick(struct rq *rq)
if (unlikely(walt_disabled))
return;
raw_spin_lock(&rq->lock);
if (list_empty(&wts->mvp_list))
return;
goto out;
walt_cfs_account_mvp_runtime(rq, rq->curr);
/*
@ -915,6 +919,9 @@ void walt_cfs_tick(struct rq *rq)
*/
if ((wrq->mvp_tasks.next != &wts->mvp_list) && rq->cfs.h_nr_running > 1)
resched_curr(rq);
out:
raw_spin_unlock(&rq->lock);
}
/*