[Devel] [PATCH VZ9 2/2] sched/stat: make cpu.proc.stat file also available in cgroup-v2

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Fri Mar 22 07:48:47 MSK 2024


We use the fact that cpuacct controller is implicitly enabled in
cgroupv-2 by previous patch. So we can just do everyting the same as we
do it on cgroup-v1 where we have both cpu and cpuacct controllers
mounted together.

Note: Stats in cpu.proc.stat give per-cpu per-cgroup usages which are
used in vcmmd to calculate per-numa cpu loads for it's balancing
algorithm. This used both for Containers and VMs.

https://virtuozzo.atlassian.net/browse/PSBM-154206
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>

Feature: sched: emulate virtual cpus for Containers
---
 kernel/sched/core.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 98e9f78e19cf..2235f1565078 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -11835,6 +11835,10 @@ static struct cftype cpu_files[] = {
 		.write = cpu_uclamp_max_write,
 	},
 #endif
+	{
+		.name = "proc.stat",
+		.seq_show = cpu_cgroup_proc_stat_show,
+	},
 	{ }	/* terminate */
 };
 
-- 
2.43.0



More information about the Devel mailing list