From a907a3cd42d7906172c24cde33073dcef3441617 Mon Sep 17 00:00:00 2001 From: Satya Durga Srinivasu Prabhala Date: Mon, 9 Aug 2021 19:11:38 -0700 Subject: [PATCH] sched/walt/walt_cfs: Improve the scheduler This change is for general scheduler improvemnts. Change-Id: Iae112690c5cf125db5d197555d47244a63bfb32e Signed-off-by: Satya Durga Srinivasu Prabhala --- kernel/sched/walt/walt.h | 1 + kernel/sched/walt/walt_cfs.c | 27 ++++++++++++++------------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/kernel/sched/walt/walt.h b/kernel/sched/walt/walt.h index f4fb1653472d..cb6459eb6082 100644 --- a/kernel/sched/walt/walt.h +++ b/kernel/sched/walt/walt.h @@ -883,6 +883,7 @@ static inline bool walt_fair_task(struct task_struct *p) #define WALT_RTG_MVP 0 #define WALT_BINDER_MVP 1 +#define WALT_TASK_BOOST_MVP 2 #define WALT_NOT_MVP -1 diff --git a/kernel/sched/walt/walt_cfs.c b/kernel/sched/walt/walt_cfs.c index 821f84df76c5..ee5b3ce30af3 100644 --- a/kernel/sched/walt/walt_cfs.c +++ b/kernel/sched/walt/walt_cfs.c @@ -961,14 +961,15 @@ static void binder_restore_priority_hook(void *data, */ static inline int walt_get_mvp_task_prio(struct task_struct *p) { - if ((per_task_boost(p) == TASK_BOOST_STRICT_MAX) || - task_rtg_high_prio(p) || - walt_procfs_low_latency_task(p)) - return WALT_RTG_MVP; + if (per_task_boost(p) == TASK_BOOST_STRICT_MAX) + return WALT_TASK_BOOST_MVP; if (walt_binder_low_latency_task(p)) return WALT_BINDER_MVP; + if (task_rtg_high_prio(p) || walt_procfs_low_latency_task(p)) + return WALT_RTG_MVP; + return WALT_NOT_MVP; } @@ -1010,15 +1011,6 @@ static void walt_cfs_deactivate_mvp_task(struct task_struct *p) list_del_init(&wts->mvp_list); wts->mvp_prio = WALT_NOT_MVP; - - /* - * Reset the exec time during sleep so that it starts - * from scratch upon next wakeup. total_exec should - * be preserved when task is enq/deq while it is on - * runqueue. - */ - if (p->state != TASK_RUNNING) - wts->total_exec = 0; } /* @@ -1114,6 +1106,15 @@ void walt_cfs_dequeue_task(struct rq *rq, struct task_struct *p) if (!list_empty(&wts->mvp_list)) walt_cfs_deactivate_mvp_task(p); + + /* + * Reset the exec time during sleep so that it starts + * from scratch upon next wakeup. total_exec should + * be preserved when task is enq/deq while it is on + * runqueue. + */ + if (p->state != TASK_RUNNING) + wts->total_exec = 0; } void walt_cfs_tick(struct rq *rq)