Re: [PATCH 0/3] tools/sched_ext: Fix three example scheduler bugs

From: liwanwu

Date: Thu Sep 24 2026 - 18:36:31 EST


Hi Tejun,

Thank you for the careful review and for catching this. It was a
serious mistake on my part, and I sincerely apologize -- I should have
tested the fixes before sending them out.

I will reproduce each bug, verify that the fix actually resolves it,
rework 3/3 properly, and send a corrected series when it is ready.

Again, my apologies for the wasted round-trip.

Wanwu

在 2026/9/25 00:17, Tejun Heo 写道:
Hello, Wanwu.

On Thu, Sep 24, 2026 at 10:36:56PM +0800, Wanwu Li wrote:
- try_dispatch() trusts a pid popped from a cgroup's FIFO. If the
task migrated to another cgroup between enqueue and dispatch, it is
dispatched under the old cgroup's context, violating the core
"paired CPUs only run tasks from the same cgroup" invariant.

3/3 calls scx_bpf_task_cgroup() on a task from bpf_task_from_pid(). The
kfunc only accepts the tasks passed to the current op, so the scheduler
is disabled on its first dispatch:

sched_ext: BPF scheduler "pair" enabled
sched_ext: BPF scheduler "pair" disabled (runtime error)
sched_ext: pair: called on a task not being operated on
scx_bpf_task_cgroup+0x15b/0x160
bpf__sched_ext_ops_dispatch+0x47/0xa3

This means the patches were posted without being run at all. That's not
acceptable. Please reproduce each bug and verify that the fix resolves it
before posting.

Thanks.