[Devel] [PATCH RHEL9 COMMIT] cpuacct: implicitly enable cpuacct controller 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 ec2a4a903eef0bd955415304910c405c3edd9daa
Author: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
Date:   Fri Mar 22 12:48:46 2024 +0800

    cpuacct: implicitly enable cpuacct controller in cgroup-v2
    
    This way the cpuacct controller is transparent to userspace but can be
    used to track cgroup cpu usages per-cpu, in next patch we will show
    those usages in cpu.proc.stat file.
    
    Notes:
     - In case cpuacct is mounted in cgroup-v1 we won't have it in cgroup-v2.
     - We also make this cgroup threaded to be able to make it implicit on
       default hierarchy. There should not be any problem as each thread
       accounts separately anyway.
    
    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/cpuacct.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/sched/cpuacct.c b/kernel/sched/cpuacct.c
index 37c102354522..55dfd37567d8 100644
--- a/kernel/sched/cpuacct.c
+++ b/kernel/sched/cpuacct.c
@@ -362,6 +362,9 @@ struct cgroup_subsys cpuacct_cgrp_subsys = {
 	.css_free	= cpuacct_css_free,
 	.legacy_cftypes	= files,
 	.early_init	= true,
+
+	.implicit_on_dfl = true,
+	.threaded       = true,
 };
 
 extern struct task_group *css_tg(struct cgroup_subsys_state *css);


More information about the Devel mailing list