[Devel] [PATCH RHEL10 COMMIT] sched/cpuacct: guard ve_root_tg() with CONFIG_CFS_CPULIMIT

Konstantin Khorenko khorenko at virtuozzo.com
Fri Aug 21 19:42:08 MSK 2026


The commit is pushed to "branch-rh10-6.12.0-211.39.1.16.x.vz10-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git
after rh10-6.12.0-211.39.1.16.6.vz10
------>
commit f7cece73a0c7d1234d2902148a729bf7d3a7759c
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Fri Aug 21 18:36:50 2026 +0200

    sched/cpuacct: guard ve_root_tg() with CONFIG_CFS_CPULIMIT
    
    ve_root_tg() has exactly two callers, tg_cpu_rate() and tg_nr_cpus(),
    and both reference it only from inside #ifdef CONFIG_CFS_CPULIMIT: the
    task_group fields they read, ::cpu_rate and ::nr_cpus, do not exist
    without that option.  So with CONFIG_CFS_CPULIMIT=n the helper is not
    used at all.  x86_64 defconfig is exactly that configuration - CONFIG_VE
    defaults to y while CONFIG_CFS_BANDWIDTH, the only thing that selects
    CONFIG_CFS_CPULIMIT, is off - and it sets CONFIG_WERROR=y as well, so
    there the unused function is not a warning but a build failure:
    
      kernel/sched/cpuacct.c:373:27: error: 've_root_tg' defined but not
                                     used [-Werror=unused-function]
    
    Compile ve_root_tg() under the same condition as its call sites.
    
    Fixes: 095994c57b84 ("ve/sched/stat: Introduce functions to calculate vcpustat data")
    Feature: sched: emulate virtual cpus for Containers
    https://virtuozzo.atlassian.net/browse/VSTOR-134732
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 kernel/sched/cpuacct.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/sched/cpuacct.c b/kernel/sched/cpuacct.c
index 01a2b2c3c5b7e..6b0ed967316e4 100644
--- a/kernel/sched/cpuacct.c
+++ b/kernel/sched/cpuacct.c
@@ -370,6 +370,7 @@ struct cgroup_subsys cpuacct_cgrp_subsys = {
 	.threaded       = true,
 };
 
+#ifdef CONFIG_CFS_CPULIMIT
 static struct task_group *ve_root_tg(struct task_group *tg) {
 	struct cgroup_subsys_state *css;
 
@@ -379,6 +380,7 @@ static struct task_group *ve_root_tg(struct task_group *tg) {
 	css = css_ve_root1(&tg->css);
 	return css ? css_tg(css) : NULL;
 }
+#endif
 
 static unsigned int tg_cpu_rate(struct task_group *tg)
 {


More information about the Devel mailing list