• Tejun Heo's avatar
    sched_ext: Add scx_cgroup_enabled to gate cgroup operations and fix scx_tg_online() · 568894ed
    Tejun Heo authored
    
    
    If the BPF scheduler does not implement ops.cgroup_init(), scx_tg_online()
    didn't set SCX_TG_INITED which meant that ops.cgroup_exit(), even if
    implemented, won't be called from scx_tg_offline(). This is because
    SCX_HAS_OP(cgroupt_init) is used to test both whether SCX cgroup operations
    are enabled and ops.cgroup_init() exists.
    
    Fix it by introducing a separate bool scx_cgroup_enabled to gate cgroup
    operations and use SCX_HAS_OP(cgroup_init) only to test whether
    ops.cgroup_init() exists. Make all cgroup operations consistently use
    scx_cgroup_enabled to test whether cgroup operations are enabled.
    scx_cgroup_enabled is added instead of using scx_enabled() to ease planned
    locking updates.
    Signed-off-by: default avatarTejun Heo <tj@kernel.org>
    568894ed
ext.c 204 KB