From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konstantin Khorenko Date: Fri, 21 Aug 2026 18:37:10 +0200 Subject: [Devel] [PATCH vz10 24/32] sched/core: include cgroup-internal.h only where it is used In-Reply-To: <20260821163718.187766-1-khorenko@virtuozzo.com> References: <20260821163718.187766-1-khorenko@virtuozzo.com> Message-ID: <20260821163718.187766-25-khorenko@virtuozzo.com> List-Id: From: Eva Kurchatova kernel/sched/core.c includes the private cgroup-internal.h for the sake of one cgroup_task_count() call in cpu_cgroup_proc_loadavg(), which lives in the CONFIG_CGROUP_SCHED part of the file. The include itself is unconditional, and it does not compile without the cgroup core: cgroup/cgroup-internal.h:188:22: error: invalid use of undefined type 'const struct cgroup' cgroup/cgroup-internal.h:188:37: error: 'CSS_ONLINE' undeclared (first use in this function) Guard the include with CONFIG_CGROUP_SCHED, the same condition as its only user. This does not make CONFIG_CGROUPS=n build by itself - struct ve_struct embeds a struct cgroup_subsys_state, so ve.h needs the cgroup core in any case - but it does keep another subsystem's private header out of scheduler translation units that have no use for it. Fixes: c0997a766674 ("ve/proc/loadavg: Virtualize /proc/loadavg in Containers") Feature: statistics: loadavg virtualization https://virtuozzo.atlassian.net/browse/VSTOR-134732 Signed-off-by: Eva Kurchatova Signed-off-by: Konstantin Khorenko --- kernel/sched/core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 7d2214749245..fb2477cb1d07 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -152,7 +152,9 @@ __read_mostly unsigned int sysctl_sched_features = __read_mostly int sysctl_resched_latency_warn_ms = 100; __read_mostly int sysctl_resched_latency_warn_once = 1; +#ifdef CONFIG_CGROUP_SCHED #include "../cgroup/cgroup-internal.h" /* For cgroup_task_count() */ +#endif /* * Number of tasks to iterate in a single balance run. -- 2.47.1