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 <[email protected]>
---
kernel/sched/core.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index ee5980b4e150..60340fa18abb 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3141,6 +3141,9 @@ static struct rq *finish_task_switch(struct task_struct *prev)
mmdrop(mm);
}
if (unlikely(prev_state == TASK_DEAD)) {
+ if (unlikely(prev->flags & PF_CAN_BE_PACKED))
+ turbo_sched_put();
+
if (prev->sched_class->task_dead)
prev->sched_class->task_dead(prev);
@@ -4793,6 +4796,10 @@ static int __sched_setscheduler(struct task_struct *p,
prev_class = p->sched_class;
+ /* Refcount tasks classified as jitter task */
+ if (task_packing_flag != (p->flags & PF_CAN_BE_PACKED))
+ (task_packing_flag) ? turbo_sched_get() : turbo_sched_put();
+
__setscheduler(rq, p, attr, pi);
__setscheduler_uclamp(p, attr);
--
2.17.1