Web lists-archives.com

[RFCv2 3/6] sched/core: Update turbo_sched count only when required




Use the get/put methods to add/remove the use of TurboSched support from
the cgroup.

Signed-off-by: Parth Shah <parth@xxxxxxxxxxxxx>
---
 kernel/sched/core.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index facbedd2554e..4c55b5399985 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7216,10 +7216,13 @@ static int cpu_util_max_write_u64(struct cgroup_subsys_state *css,
 	 * Classify the tasks belonging to the last bucket of MAX UCLAMP as
 	 * jitters
 	 */
-	if (uclamp_bucket_id(max_value) == 0)
+	if (uclamp_bucket_id(max_value) == 0) {
 		tg->turbo_sched_enabled = 1;
-	else if (tg->turbo_sched_enabled)
+		turbo_sched_get();
+	} else if (tg->turbo_sched_enabled) {
 		tg->turbo_sched_enabled = 0;
+		turbo_sched_put();
+	}
 
 	/* Update effective clamps to track the most restrictive value */
 	cpu_util_update_eff(css, UCLAMP_MAX);
-- 
2.17.1