From d233af280c6c7bf6513c5f1564564a3862d59b43 Mon Sep 17 00:00:00 2001 From: Pavankumar Kondeti Date: Thu, 27 May 2021 10:24:50 +0530 Subject: [PATCH] sched/walt: Do the rq clock update before MVP tasks update The rq clock gets updated in the scheduler tick. However, if the lock is acquired remotely between the scheduler tick and the vendor hook, the clock update flags gets reset. Do the clock update in walt_cfs_account_mvp_runtime based on the clock update flags. Change-Id: Ie4254a191a18458cf1684070bc96ff63cf0103d3 Signed-off-by: Pavankumar Kondeti --- kernel/sched/walt/walt_cfs.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/kernel/sched/walt/walt_cfs.c b/kernel/sched/walt/walt_cfs.c index 93eaf6cbd584..02d1c891242a 100644 --- a/kernel/sched/walt/walt_cfs.c +++ b/kernel/sched/walt/walt_cfs.c @@ -830,6 +830,16 @@ static void walt_cfs_account_mvp_runtime(struct rq *rq, struct task_struct *curr lockdep_assert_held(&rq->lock); + /* + * RQ clock update happens in tick path in the scheduler. + * Since we drop the lock in the scheduler before calling + * into vendor hook, it is possible that update flags are + * reset by another rq lock and unlock. Do the update here + * if required. + */ + if (!(rq->clock_update_flags & RQCF_UPDATED)) + update_rq_clock(rq); + /* sum_exec_snapshot can be ahead. See below increment */ delta = curr->se.sum_exec_runtime - wts->sum_exec_snapshot; if (delta < 0)