[Devel] [PATCH RHEL10 COMMIT] sched/core: include cgroup-internal.h only where it is used

Konstantin Khorenko khorenko at virtuozzo.com
Fri Aug 21 19:42:24 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 cdd5aa0c11e9db9ca76c5088afff92da459e467f
Author: Eva Kurchatova <eva.kurchatova at virtuozzo.com>
Date:   Fri Aug 21 18:37:10 2026 +0200

    sched/core: include cgroup-internal.h only where it is used
    
    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 <eva.kurchatova at virtuozzo.com>
    
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 kernel/sched/core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 7d2214749245b..fb2477cb1d076 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.


More information about the Devel mailing list