lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220209134319.1183-1-quic_ctheegal@quicinc.com>
Date:   Wed, 9 Feb 2022 19:13:19 +0530
From:   Chitti Babu Theegala <quic_ctheegal@...cinc.com>
To:     <mingo@...hat.com>, <peterz@...radead.org>,
        <juri.lelli@...hat.com>, <vincent.guittot@...aro.org>,
        <dietmar.eggemann@....com>, <rostedt@...dmis.org>,
        <joel@...lfernandes.org>, <linux-arm-msm@...r.kernel.org>,
        <quic_lingutla@...cinc.com>, <linux-kernel@...r.kernel.org>
Subject: [PATCH] sched/uclamp: New sysctl to tweak boost for uclamp tasks

UCLAMP_MIN knob clamps the util_value within uclamp_min & max.
Currently, these uclamped tasks are also boosted to big cores
which can hit power.

Implementing a new knob which can provide an option to turn-off
'boosting to big cores' and just restrict to 'clamping util value'
job. Also, note that big cores affinity can be separately achieved
with cpuset cgroups as well, if required for any critical tasks.

Signed-off-by: Chitti Babu Theegala <quic_ctheegal@...cinc.com>
---
 include/linux/sched/sysctl.h | 1 +
 kernel/sched/core.c          | 8 ++++++++
 kernel/sched/fair.c          | 2 +-
 kernel/sysctl.c              | 9 +++++++++
 4 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h
index be27e725b9285..fa7abecf6cd68 100644
--- a/include/linux/sched/sysctl.h
+++ b/include/linux/sched/sysctl.h
@@ -54,6 +54,7 @@ extern unsigned int sysctl_sched_dl_period_min;
 extern unsigned int sysctl_sched_uclamp_util_min;
 extern unsigned int sysctl_sched_uclamp_util_max;
 extern unsigned int sysctl_sched_uclamp_util_min_rt_default;
+extern unsigned int sysctl_sched_uclamp_util_min_to_boost;
 #endif
 
 #ifdef CONFIG_CFS_BANDWIDTH
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 634d571e39d77..55019eb9c83c5 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1269,6 +1269,14 @@ unsigned int sysctl_sched_uclamp_util_max = SCHED_CAPACITY_SCALE;
  */
 unsigned int sysctl_sched_uclamp_util_min_rt_default = SCHED_CAPACITY_SCALE;
 
+/* UCLAMP_MIN knob clamps the util_value within uclamp_min & max. By default,
+ * these uclamped tasks are also boosted to bigger cores which can impact power.
+ *
+ * This knob provides an option to turn-off 'boosting to gold cores' and
+ * just restrict to 'clamping util value' job.
+ */
+unsigned int sysctl_sched_uclamp_util_min_to_boost = 1;
+
 /* All clamps are required to be less or equal than these values */
 static struct uclamp_se uclamp_default[UCLAMP_CNT];
 
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 7cd316793f4e3..44adcbfa9eb32 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -6829,7 +6829,7 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu, int sy
 		goto unlock;
 
 	latency_sensitive = uclamp_latency_sensitive(p);
-	boosted = uclamp_boosted(p);
+	boosted = sysctl_sched_uclamp_util_min_to_boost && uclamp_boosted(p);
 	target_cap = boosted ? 0 : ULONG_MAX;
 
 	for (; pd; pd = pd->next) {
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 8f196ed2ec065..6463d60fed84e 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1882,6 +1882,15 @@ static struct ctl_table kern_table[] = {
 		.mode		= 0644,
 		.proc_handler	= sysctl_sched_uclamp_handler,
 	},
+	{
+		.procname	= "sched_util_clamp_min_to_boost",
+		.data		= &sysctl_sched_uclamp_util_min_to_boost,
+		.maxlen		= sizeof(unsigned int),
+		.mode		= 0644,
+		.proc_handler	= proc_dointvec_minmax,
+		.extra1		= SYSCTL_ZERO,
+		.extra2		= SYSCTL_ONE,
+	},
 #endif
 #ifdef CONFIG_SCHED_AUTOGROUP
 	{
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ