[Devel] [PATCH RH8] sched: allow configuring sched_vcpu_hotslice and sched_cpulimit_scale_cpufreq

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Fri May 7 13:50:25 MSK 2021


Let's make our sysctls ported from vz8 to be really configurable.

These are lost hunks from vz7 commits:
f06fef25c0859 ("sched: Add cpulimit base interfaces")
4805ea1432210 ("ve/sched: port vcpu hotslice")

https://jira.sw.ru/browse/PSBM-127780
Fixes: ddbb18ac80519 ("sched: Port CONFIG_CFS_CPULIMIT feature")

Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 include/linux/sched.h        |  2 --
 include/linux/sched/sysctl.h |  5 +++++
 kernel/sysctl.c              | 19 +++++++++++++++++++
 3 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 9846553f70393..76cc39785a56a 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1855,8 +1855,6 @@ static inline bool vcpu_is_preempted(int cpu)
 #ifdef CONFIG_CFS_CPULIMIT
 extern unsigned int task_nr_cpus(struct task_struct *p);
 extern unsigned int task_vcpu_id(struct task_struct *p);
-extern unsigned int sysctl_sched_vcpu_hotslice;
-extern unsigned int sysctl_sched_cpulimit_scale_cpufreq;
 extern unsigned int sched_cpulimit_scale_cpufreq(unsigned int freq);
 #else
 static inline unsigned int task_nr_cpus(struct task_struct *p)
diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h
index 68e900f1c94c6..f5d0a15e34e1b 100644
--- a/include/linux/sched/sysctl.h
+++ b/include/linux/sched/sysctl.h
@@ -89,4 +89,9 @@ extern int sched_energy_aware_handler(struct ctl_table *table, int write,
 				 loff_t *ppos);
 #endif
 
+#ifdef CONFIG_CFS_CPULIMIT
+extern unsigned int sysctl_sched_vcpu_hotslice;
+extern unsigned int sysctl_sched_cpulimit_scale_cpufreq;
+#endif
+
 #endif /* _LINUX_SCHED_SYSCTL_H */
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 06fe50ae25751..98b230fe580c1 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -501,6 +501,25 @@ static struct ctl_table kern_table[] = {
 		.extra2		= &one,
 	},
 #endif
+#ifdef CONFIG_CFS_CPULIMIT
+	{
+		.procname	= "sched_vcpu_hotslice",
+		.data		= &sysctl_sched_vcpu_hotslice,
+		.maxlen		= sizeof(unsigned int),
+		.mode		= 0644,
+		.proc_handler	= proc_dointvec_minmax,
+		.extra1		= &zero,
+	},
+	{
+		.procname	= "sched_cpulimit_scale_cpufreq",
+		.data		= &sysctl_sched_cpulimit_scale_cpufreq,
+		.maxlen		= sizeof(unsigned int),
+		.mode		= 0644,
+		.proc_handler	= proc_dointvec,
+		.extra1		= &zero,
+		.extra2		= &one,
+	},
+#endif
 #ifdef CONFIG_PROVE_LOCKING
 	{
 		.procname	= "prove_locking",
-- 
2.30.2



More information about the Devel mailing list