[Devel] [PATCH RHEL8 COMMIT] sched: Allow configuring sched_vcpu_hotslice and sched_cpulimit_scale_cpufreq

Konstantin Khorenko khorenko at virtuozzo.com
Tue May 11 18:37:06 MSK 2021


The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.27
------>
commit e84f7c70d285604a676ba7417e622df9fee3dc90
Author: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
Date:   Tue May 11 18:37:06 2021 +0300

    sched: Allow configuring sched_vcpu_hotslice and sched_cpulimit_scale_cpufreq
    
    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 9846553f7039..76cc39785a56 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 68e900f1c94c..f5d0a15e34e1 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 06fe50ae2575..98b230fe580c 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",


More information about the Devel mailing list