Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

sched_ext: Documentation: Add ops.dequeue() to task lifecycle

Document ops.dequeue() in the sched_ext task lifecycle now that its
semantics are well-defined.

Also update the pseudo-code to use task_is_runnable() consistently and
clarify the case where ops.dispatch() does not refill the time slice.

Signed-off-by: Andrea Righi <arighi@nvidia.com>
Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
Signed-off-by: Tejun Heo <tj@kernel.org>

authored by

Andrea Righi and committed by
Tejun Heo
a4f61f0a a3c3fb2f

+16 -10
+16 -10
Documentation/scheduler/sched-ext.rst
··· 422 422 423 423 ops.runnable(); /* Task becomes ready to run */ 424 424 425 - while (task is runnable) { 425 + while (task_is_runnable(task)) { 426 426 if (task is not in a DSQ && task->scx.slice == 0) { 427 427 ops.enqueue(); /* Task can be added to a DSQ */ 428 428 429 - /* Any usable CPU becomes available */ 430 - 431 - ops.dispatch(); /* Task is moved to a local DSQ */ 432 - 433 - ops.dequeue(); /* Exiting BPF scheduler */ 429 + /* Task property change (i.e., affinity, nice, etc.)? */ 430 + if (sched_change(task)) { 431 + ops.dequeue(); /* Exiting BPF scheduler custody */ 432 + continue; 433 + } 434 434 } 435 + 436 + /* Any usable CPU becomes available */ 437 + 438 + ops.dispatch(); /* Task is moved to a local DSQ */ 439 + ops.dequeue(); /* Exiting BPF scheduler custody */ 440 + 435 441 ops.running(); /* Task starts running on its assigned CPU */ 436 442 437 - while task_is_runnable(p) { 438 - while (task->scx.slice > 0 && task_is_runnable(p)) 439 - ops.tick(); /* Called every 1/HZ seconds */ 443 + while (task_is_runnable(task) && task->scx.slice > 0) { 444 + ops.tick(); /* Called every 1/HZ seconds */ 440 445 441 - ops.dispatch(); /* task->scx.slice can be refilled */ 446 + if (task->scx.slice == 0) 447 + ops.dispatch(); /* task->scx.slice can be refilled */ 442 448 } 443 449 444 450 ops.stopping(); /* Task stops running (time slice expires or wait) */