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

Konstantin Khorenko khorenko at virtuozzo.com
Fri Mar 22 19:03:02 MSK 2024


The commit is pushed to "branch-rh9-5.14.0-362.18.1.vz9.40.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh9-5.14.0-362.18.1.vz9.40.3
------>
commit c750dd4d52d0928dee3ebe29da9fddeecc55a942
Author: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
Date:   Fri Mar 22 12:48:47 2024 +0800

    sched/stat: make cpu.proc.stat file also available in cgroup-v2
    
    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 d1889acbe285..1d0f08ee16ec 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -11866,6 +11866,10 @@ static struct cftype cpu_files[] = {
 		.write = cpu_uclamp_max_write,
 	},
 #endif
+	{
+		.name = "proc.stat",
+		.seq_show = cpu_cgroup_proc_stat_show,
+	},
 	{ }	/* terminate */
 };
 


More information about the Devel mailing list