[Devel] [PATCH RHEL10 COMMIT] ve/sched.h: Reorder ve-related functions and ifdef guards

Konstantin Khorenko khorenko at virtuozzo.com
Fri Jun 5 21:32:31 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.29.vz10
------>
commit 899b3915aadd83ecbcc5e0d4dd0cc52cdfe1dcf6
Author: Vladimir Riabchun <vladimir.riabchun at virtuozzo.com>
Date:   Tue Jun 2 21:11:01 2026 +0000

    ve/sched.h: Reorder ve-related functions and ifdef guards
    
    When !CONFIG_VE, we define noop cpu_cgroup_proc_* functions,
    but they actually have bodies in cpuacct.c.
    
    Move their declarations outside CONFIG_VE and inside
    CONFIG_CGROUP_CPUACCT.
    This fixes a ton of annoying compiler warnings:
    kernel/sched/cpuacct.c: At top level:
    kernel/sched/cpuacct.c:758:5: warning: no previous prototype for 'cpu_cgroup_get_stat' [-Wmissing-prototypes]
      758 | int cpu_cgroup_get_stat(struct cgroup_subsys_state *cpu_css,
          |     ^~~~~~~~~~~~~~~~~~~
    
    This change is hard to make as a fixup - it reorders lines
    from several commits:
     - bc5aa6c ("ve/sched: Link VE root cpu cgroups in separate list")
     - 3465846 ("sched: show CPU stats for a cgroup in cpu.proc.stat file")
     - 9148856 ("ve/sched/stat: Introduce handler for getting CT cpu statistics")
     - a87d08b ("ve/proc/stat: Wire virtualized /proc/stat handler")
    
    https://virtuozzo.atlassian.net/browse/VSTOR-130116
    
    Feature: !CONFIG_VE build
    Signed-off-by: Vladimir Riabchun <vladimir.riabchun at virtuozzo.com>
    Reviewed-by: Vasileios Almpanis <vasileios.almpanis at virtuozzo.com>
---
 include/linux/sched.h | 30 +++++++++++++++++++++---------
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 04285af753899..bffd6a5cf6787 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2245,10 +2245,10 @@ static inline int sched_core_idle_cpu(int cpu) { return idle_cpu(cpu); }
 extern void sched_set_stop_task(int cpu, struct task_struct *stop);
 
 struct cgroup_subsys_state;
-#ifdef CONFIG_VE
-void link_ve_root_cpu_cgroup(struct cgroup_subsys_state *css);
-void unlink_ve_root_cpu_cgroup(struct cgroup_subsys_state *css);
+
 int cpu_cgroup_proc_loadavg(struct cgroup_subsys_state *css, struct seq_file *p);
+
+#ifdef CONFIG_CGROUP_CPUACCT
 int cpu_cgroup_proc_stat_show(struct seq_file *sf, void *v);
 int cpu_cgroup_get_stat(struct cgroup_subsys_state *cpu_css,
 			struct cgroup_subsys_state *cpuacct_css,
@@ -2256,14 +2256,14 @@ int cpu_cgroup_get_stat(struct cgroup_subsys_state *cpu_css,
 int cpu_cgroup_proc_stat(struct cgroup_subsys_state *cpu_css,
 			 struct cgroup_subsys_state *cpuacct_css,
 			 struct seq_file *p);
-#else /* CONFIG_VE */
-static inline void link_ve_root_cpu_cgroup(struct cgroup_subsys_state *css)
-{
-}
-static inline void unlink_ve_root_cpu_cgroup(struct cgroup_subsys_state *css)
+#else /* CONFIG_CGROUP_CPUACCT */
+static inline int cpu_cgroup_proc_stat_show(struct seq_file *sf, void *v)
 {
+	return 0;
 }
-static inline int cpu_cgroup_proc_stat_show(struct seq_file *sf, void *v)
+static inline int cpu_cgroup_get_stat(struct cgroup_subsys_state *cpu_css,
+			struct cgroup_subsys_state *cpuacct_css,
+			struct kernel_cpustat *kstat)
 {
 	return 0;
 }
@@ -2273,6 +2273,18 @@ static inline int cpu_cgroup_proc_stat(struct cgroup_subsys_state *cpu_css,
 {
 	return 0;
 }
+#endif /* CONFIG_CGROUP_CPUACCT */
+
+#ifdef CONFIG_VE
+void link_ve_root_cpu_cgroup(struct cgroup_subsys_state *css);
+void unlink_ve_root_cpu_cgroup(struct cgroup_subsys_state *css);
+#else /* CONFIG_VE */
+static inline void link_ve_root_cpu_cgroup(struct cgroup_subsys_state *css)
+{
+}
+static inline void unlink_ve_root_cpu_cgroup(struct cgroup_subsys_state *css)
+{
+}
 #endif /* CONFIG_VE */
 
 #ifdef CONFIG_MEM_ALLOC_PROFILING


More information about the Devel mailing list