]> www.infradead.org Git - users/jedix/linux-maple.git/commit
sched_ext: Add @sch to SCX_CALL_OP*()
authorTejun Heo <tj@kernel.org>
Wed, 14 May 2025 15:11:48 +0000 (11:11 -0400)
committerTejun Heo <tj@kernel.org>
Wed, 14 May 2025 15:11:48 +0000 (11:11 -0400)
commita8433f7a267f9fcf14822c08ab89b6021a8ba536
tree932ef64fff527689665f7ebff2780fdfea404a0b
parentc4c286d747971c410739afc216972f1cc0923270
sched_ext: Add @sch to SCX_CALL_OP*()

In preparation of hierarchical scheduling support, add @sch to scx_exit()
and friends:

- scx_exit/error() updated to take explicit @sch instead of assuming
  scx_root.

- scx_kf_exit/error() added. These are to be used from kfuncs, don't take
  @sch and internally determine the scx_sched instance to abort. Currently,
  it's always scx_root but once multiple scheduler support is in place, it
  will be the scx_sched instance that invoked the kfunc. This simplifies
  many callsites and defers scx_sched lookup until error is triggered.

- @sch is propagated to ops_cpu_valid() and ops_sanitize_err(). The CPU
  validity conditions in ops_cpu_valid() are factored into __cpu_valid() to
  implement kf_cpu_valid() which is the counterpart to scx_kf_exit/error().

- All users are converted. Most conversions are straightforward.
  check_rq_for_timeouts() and scx_softlockup() are updated to use explicit
  rcu_dereference*(scx_root) for safety as they may execute asynchronous to
  the exit path. scx_tick() is also updated to use rcu_dereference(). While
  not strictly necessary due to the preceding scx_enabled() test and IRQ
  disabled context, this removes the subtlety at no noticeable cost.

No behavior changes intended.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Andrea Righi <arighi@nvidia.com>
kernel/sched/ext.c
kernel/sched/ext_idle.c