From c12499d9380d1930a64e7b25cdb3b3513b56c037 Mon Sep 17 00:00:00 2001 From: Pavankumar Kondeti Date: Thu, 25 Mar 2021 09:49:45 +0530 Subject: [PATCH] sched/walt: Adjust code as per new dequeue_task() hook invocation dequeue_task() hook invocation is being changed from post dequeue to pre dequeue. Consider the task being dequeued is out of the scheduling class managed list. Change-Id: Ib95ec7f8a873587493487a3c31c3f53ea78b0d95 Signed-off-by: Pavankumar Kondeti --- kernel/sched/walt/walt.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/kernel/sched/walt/walt.c b/kernel/sched/walt/walt.c index 790a2167aded..ab3f4a6d0b62 100644 --- a/kernel/sched/walt/walt.c +++ b/kernel/sched/walt/walt.c @@ -419,7 +419,7 @@ static inline bool is_ed_task(struct task_struct *p, u64 wallclock) return (wallclock - wts->last_wake_ts >= EARLY_DETECTION_DURATION); } -static bool is_ed_task_present(struct rq *rq, u64 wallclock) +static bool is_ed_task_present(struct rq *rq, u64 wallclock, struct task_struct *deq_task) { struct task_struct *p; int loop_max = 10; @@ -434,6 +434,9 @@ static bool is_ed_task_present(struct rq *rq, u64 wallclock) if (!loop_max) break; + if (p == deq_task) + continue; + if (is_ed_task(p, wallclock)) { wrq->ed_task = p; return true; @@ -3758,7 +3761,7 @@ static void android_rvh_dequeue_task(void *unused, struct rq *rq, struct task_st if (unlikely(walt_disabled)) return; if (p == wrq->ed_task) - is_ed_task_present(rq, sched_ktime_clock()); + is_ed_task_present(rq, sched_ktime_clock(), p); sched_update_nr_prod(rq->cpu, false); @@ -3866,7 +3869,7 @@ static void android_rvh_tick_entry(void *unused, struct rq *rq) set_preferred_cluster(grp); rcu_read_unlock(); - if (is_ed_task_present(rq, wallclock)) + if (is_ed_task_present(rq, wallclock, NULL)) waltgov_run_callback(rq, WALT_CPUFREQ_EARLY_DET); }