Re: [PATCH 08/31] sched: Expose css_tg() and __setscheduler_prio() in kernel/sched/sched.h

From: Tejun Heo
Date: Mon Dec 12 2022 - 12:47:35 EST


On Mon, Dec 12, 2022 at 12:49:59PM +0100, Peter Zijlstra wrote:
> On Tue, Nov 29, 2022 at 10:22:50PM -1000, Tejun Heo wrote:
> > These will be used by a new sched_class.
>
> Uhhh.. wtf does a policy need __setscheduler_prio() for?

Whether a task is on sched_ext or not is determined by a few factors - the
chosen sched class of the task, whether the BPF scheduler is loaded and
whether it's using scx_bpf_switch_all(). That selection logic is implemented
in __setscheduler_prio(). When the BPF scheduler gets initialized and
exited, the selection changes and sched_ext needs to walk the tasks
reapplying the selection logic, so the export.

This ties together with the sched_enq_and_set_task() that you replied to in
another thread. Imma continue there.

--
tejun