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 <[email protected]>
---
 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 04285af75389..bffd6a5cf678 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
-- 
2.47.1

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to