Re: [PATCH v3 3/3] sched_ext: Allow scx_bpf_reenqueue_local() to be called from anywhere
From: Kuba Piecuch
Date: Thu Nov 27 2025 - 05:39:38 EST
On Wed Oct 29, 2025 at 3:49 PM UTC, Tejun Heo wrote:
> Schedulers can now use standard BPF mechanisms like the sched_switch tracepoint
> to detect and handle CPU preemption.
Correct me if I'm wrong, but I think using the sched_switch tracepoint still
leaves us with no preemption notification in the following scenario:
1. An RT task is running on the CPU and blocks.
2. pick_task_scx() briefly drops the rq lock in balance_one() and the RT task
is woken up.
3. SCX sees the enqueue and returns RETRY_TASK from pick_task_scx().
4. The RT task is picked.
5. Since prev == next, we don't enter the is_switch branch in __schedule()
and the sched_switch tracepoint isn't reached.
The BPF scheduler could hook into trace_sched_exit_tp() to work around this,
but that tracepoint seems to be for testing and debugging purposes only.