[Devel] [PATCH RHEL10 COMMIT] sched: Support nr_cpus in cgroup2 as well
Konstantin Khorenko
khorenko at virtuozzo.com
Thu Mar 19 16:22:53 MSK 2026
The commit is pushed to "branch-rh10-6.12.0-55.52.1.5.x.vz10-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git
after rh10-6.12.0-55.52.1.5.10.vz10
------>
commit 79eae2182938d805d8cc4e0678d58e2df7f0db2a
Author: Dmitry Sepp <dmitry.sepp at virtuozzo.com>
Date: Thu Mar 19 09:47:19 2026 +0000
sched: Support nr_cpus in cgroup2 as well
Make the control available for the cgroup2 hierarchy as well.
https://virtuozzo.atlassian.net/browse/VSTOR-124385
Signed-off-by: Dmitry Sepp <dmitry.sepp at virtuozzo.com>
======
Patchset description:
sched: Clean up vCPU handling code
The idea behind the change is to transition from the existing spatial
vCPU handling approach that introduces costly modification to the
scheduling logic to ensure the requested CPU count is obeyed
(10%+ performance drop in some tests, see below) to
temporal isolation that can be provided by the cgroup2 cpu.max.
Reference test results:
1. Clean setup, no vCPU related modifications:
~/at_process_ctxswitch_pipe -w -p 2 -t 15
rate_total: 856509.625000, avg: 428254.812500
2. vCPU related modifications (present state):
~/at_process_ctxswitch_pipe -w -p 2 -t 15
rate_total: 735626.812500, avg: 367813.406250
3. Cleaned-up vCPU handling:
~/at_process_ctxswitch_pipe -w -p 2 -t 15
rate_total: 840074.750000, avg: 420037.375000
Feature: sched: ability to limit number of CPUs available to a CT
---
kernel/sched/core.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index cf2afc1307c5d..0423c1b323caf 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -10440,6 +10440,14 @@ static struct cftype cpu_files[] = {
.seq_show = cpu_uclamp_max_show,
.write = cpu_uclamp_max_write,
},
+#endif
+#ifdef CONFIG_CFS_CPULIMIT
+ {
+ .name = "nr_cpus",
+ .flags = CFTYPE_NOT_ON_ROOT,
+ .read_u64 = nr_cpus_read_u64,
+ .write_u64 = nr_cpus_write_u64,
+ },
#endif
{
.name = "proc.stat",
More information about the Devel
mailing list