[RFCv3 3/8] sched/core: Update turbo_sched count only when required
From: Parth Shah
Date: Tue Jun 25 2019 - 00:37:44 EST
Use the get/put methods to add/remove the use of TurboSched support, such
that the feature is turned on only if there is atleast one jitter task.
Signed-off-by: Parth Shah <parth@xxxxxxxxxxxxx>
---
kernel/sched/core.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index ef83725bd4b0..c7b628d0be2b 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1214,10 +1214,13 @@ static void __setscheduler_uclamp(struct task_struct *p,
* Set task to jitter class if Max util is clamped to the least
* possible value
*/
- if (p->uclamp_req[UCLAMP_MAX].bucket_id == 0 && !p->is_jitter)
+ if (p->uclamp_req[UCLAMP_MAX].bucket_id == 0 && !p->is_jitter) {
p->is_jitter = 1;
- else if (p->is_jitter)
+ turbo_sched_get();
+ } else if (p->is_jitter) {
p->is_jitter = 0;
+ turbo_sched_put();
+ }
}
}
@@ -3215,6 +3218,9 @@ static struct rq *finish_task_switch(struct task_struct *prev)
mmdrop(mm);
}
if (unlikely(prev_state == TASK_DEAD)) {
+ if (unlikely(prev->is_jitter))
+ turbo_sched_put();
+
if (prev->sched_class->task_dead)
prev->sched_class->task_dead(prev);
--
2.17.1