Re: [PATCH sched_ext/for-6.12] sched_ext: Handle cases where pick_task_scx() is called without preceding balance_scx()

Peter Zijlstra
2024-09-05T09:29:02Z

On Wed, Sep 04, 2024 at 02:47:03PM -1000, Tejun Heo wrote:
> sched_ext dispatches tasks from the BPF scheduler from balance_scx() and
> thus every pick_task_scx() call must be preceded by balance_scx(). While
> this usually holds, there are rare cases where a higher sched class's
> balance() returns true indicating that it has tasks to run on the CPU and
> thus terminating balance() calls but fails to actually find the next task to
> run when pick_task() is called.

Oh cute. Which class in particular did you see this do?

Looking at balance_fair() / sched_balance_newidle() I suppose we could
verify we actually have a runnable task once we've re-acquired the
rq-lock and have pulled_task > 0.

Tightening all that up would probably be better than trying to deal with
the fallout like this, hmm?