]> www.infradead.org Git - users/hch/configfs.git/commit
sched_ext: Add scx_cgroup_enabled to gate cgroup operations and fix scx_tg_online()
authorTejun Heo <tj@kernel.org>
Fri, 27 Sep 2024 20:02:40 +0000 (10:02 -1000)
committerTejun Heo <tj@kernel.org>
Fri, 27 Sep 2024 20:02:40 +0000 (10:02 -1000)
commit568894edbe48f0878f787ed533dc9dbfd09c0fbe
tree978e049b22c42e08fa61758858b19a2f572727e6
parent4269c603cc26df154e0db303a9347e6ec3cc805e
sched_ext: Add scx_cgroup_enabled to gate cgroup operations and fix scx_tg_online()

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: Tejun Heo <tj@kernel.org>
kernel/sched/ext.c