linux/kernel/sched/ext
Tejun Heo df5cdc2c83 sched_ext: Derive SCX_RQ_IN_WAKEUP from the core enqueue flags
schedule_deferred_locked() skips scheduling a deferred action while
SCX_RQ_IN_WAKEUP is set and relies on the task_woken_scx() call that follows
a wakeup enqueue to run it. enqueue_task_scx() sets the flag from the merged
enqueue flags, which include the flags stashed for a remote activation.
move_remote_task_to_local_dsq() thus sets SCX_RQ_IN_WAKEUP on the
destination rq when the moved task was woken up, although no
task_woken_scx() follows that activation.

An IMMED insert into a busy destination requests a local reenqueue during
that enqueue. The request gets linked but not scheduled and stays pending
until an unrelated wakeup or preemption on that CPU runs the deferred
actions. The IMMED task sits behind the running task in the meantime. If
nothing runs them before the scheduler is disabled, the request outlives the
scheduler and points into its freed per-cpu area, which the next scheduler
dereferences from run_deferred().

Test the core enqueue flags for the wakeup bit. Only the core's wakeup path
is followed by task_woken_scx().

Fixes: 57ccf5ccdc ("sched_ext: Fix enqueue_task_scx() truncation of upper enqueue flags")
Cc: stable@vger.kernel.org # v7.1+
Reported-by: Andrea Righi <arighi@nvidia.com>
Link: https://lore.kernel.org/all/20260916145807.3250167-1-arighi@nvidia.com/
Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Andrea Righi <arighi@nvidia.com>
2026-09-17 06:45:32 -10:00
..
arena.c sched_ext: Pass kernel arena pointers to ops_cid callbacks 2026-08-12 09:55:33 -10:00
arena.h
cid.c sched_ext: Convert scx_bpf_cid_override() to __arena array arguments 2026-08-12 09:55:33 -10:00
cid.h sched_ext: Gate cid kfuncs behind the SCX struct_ops check 2026-08-12 08:29:15 -10:00
ext.c sched_ext: Derive SCX_RQ_IN_WAKEUP from the core enqueue flags 2026-09-17 06:45:32 -10:00
ext.h
idle.c sched_ext: Fix NULL sched deref in kfunc sub-sched error paths 2026-09-03 07:35:12 -10:00
idle.h
inlines.h sched_ext: Rename balance-era identifiers to dispatch terms 2026-08-15 00:07:42 -10:00
internal.h sched_ext: Wait for SCX_OPSS_DISPATCHING before reenqueueing a task 2026-09-15 12:34:44 -10:00
sub.c sched_ext: Wait for SCX_OPSS_DISPATCHING before reenqueueing a task 2026-09-15 12:34:44 -10:00
sub.h sched_ext: Add bandwidth-limited rescue execution for stranded tasks 2026-08-03 11:01:29 -10:00
types.h sched_ext: Convert sub-cap kfuncs to __arena cmask arguments 2026-08-12 09:55:33 -10:00