Slide 11
Slide 11 text
Scheduling Cycle: Runqueue balance/dispatch
Start balance
Does the CPU have
locally dispatched
tasks?
void (*dispatch)(s32 cpu, struct task_struct *prev);
Dispatch tasks to local DSQ or transfer tasks to
local DSQ
Were any tasks
dispatched in the
callback?
CPU will go to idle Task successfully
balanced to core
Y
N
Y
N
If there still isn't a task to run, ops.dispatch() is invoked.
We can use the following function to populate local DSQ:
● scx_bpf_dispatch(): dispatch a task to a DSQ
● scx_bpf_comsume(): transfer a task to the
dispatching DSQ
After ops.dispatch() returns, the following steps are taken:
● Try to consume DSQ’s, if successful, run the task
● If “dispatched” tasks, retry the first branch
● Previous task is still “runnable”, keep executing it
● Idle
When a CPU is ready to schedule, it first looks at its local
DSQ. if empty, it then looks at the global DSQ.