diff options
| author | Tejun Heo <tj@kernel.org> | 2026-05-10 12:21:58 -1000 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2026-05-10 12:43:24 -1000 |
| commit | f25ad1e3cbaa4c87bb2b11496786f79db54c294f (patch) | |
| tree | 5befa4d2b1285dc8acd8a9faeaaf62b2420701bb /include/linux/timerqueue.h | |
| parent | 03d958da4f355c380819a3baf339123c25db8e54 (diff) | |
sched_ext: Add scx_task_iter_relock() and use it in scx_root_enable_workfn()
scx_root_enable_workfn()'s post-init block re-acquires scx_tasks_lock
briefly via a scoped_guard() for the tid hash insertion. c941d7391f25
("sched_ext: Close root-enable vs sched_ext_dead() race with
SCX_TASK_INIT_BEGIN") on for-7.1-fixes adds a post-init DEAD recheck that
holds the task's rq lock across the state-machine updates in the same
region. A naive merge would acquire scx_tasks_lock while the rq lock is
held, inverting the iter's outer/inner order (scx_tasks_lock then rq lock).
Add scx_task_iter_relock(iter, p), the counterpart to
scx_task_iter_unlock(), that re-acquires scx_tasks_lock and, if @p is
non-NULL, @p's rq lock. The locks are tracked in @iter so subsequent
iteration releases them.
Use it in scx_root_enable_workfn()'s post-init block and drop the
now-redundant scoped_guard on the hash insertion. The post-init region now
runs with both scx_tasks_lock and the task's rq lock held across the init
failure check, the state-machine updates and the hash insert.
v2: Move scx_task_iter_relock() earlier to ease the for-7.1-fixes merge.
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'include/linux/timerqueue.h')
0 files changed, 0 insertions, 0 deletions
