diff mbox series

[RFCv3,3/8] sched/core: Update turbo_sched count only when required

Message ID 20190625043726.21490-4-parth@linux.ibm.com (mailing list archive)
State RFC, archived
Headers show
Series TurboSched: A scheduler for sustaining Turbo Frequencies for longer durations | expand

Commit Message

Parth Shah June 25, 2019, 4:37 a.m. UTC
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@linux.ibm.com>
---
 kernel/sched/core.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
diff mbox series

Patch

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);