mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-25 23:02:51 -04:00
sched_ext: Documentation: Clarify time slice handling in task lifecycle
It is not always obvious how a task's time slice can be refilled, either explicitly from ops.dispatch() or automatically by the sched_ext core, to skip subsequent ops.enqueue() and ops.dispatch() calls. This typically happens when the task is the only one running on a CPU. To make this behavior easier to understand, update the task lifecycle diagram to explicitly document how time slice handling works in such cases. Signed-off-by: Andrea Righi <arighi@nvidia.com> Signed-off-by: Tejun Heo <tj@kernel.org>
This commit is contained in:
@@ -313,16 +313,21 @@ by a sched_ext scheduler:
|
|||||||
ops.runnable(); /* Task becomes ready to run */
|
ops.runnable(); /* Task becomes ready to run */
|
||||||
|
|
||||||
while (task is runnable) {
|
while (task is runnable) {
|
||||||
if (task is not in a DSQ) {
|
if (task is not in a DSQ && task->scx.slice == 0) {
|
||||||
ops.enqueue(); /* Task can be added to a DSQ */
|
ops.enqueue(); /* Task can be added to a DSQ */
|
||||||
|
|
||||||
/* A CPU becomes available */
|
/* Any usable CPU becomes available */
|
||||||
|
|
||||||
ops.dispatch(); /* Task is moved to a local DSQ */
|
ops.dispatch(); /* Task is moved to a local DSQ */
|
||||||
}
|
}
|
||||||
ops.running(); /* Task starts running on its assigned CPU */
|
ops.running(); /* Task starts running on its assigned CPU */
|
||||||
ops.tick(); /* Called every 1/HZ seconds */
|
while (task->scx.slice > 0 && task is runnable)
|
||||||
|
ops.tick(); /* Called every 1/HZ seconds */
|
||||||
ops.stopping(); /* Task stops running (time slice expires or wait) */
|
ops.stopping(); /* Task stops running (time slice expires or wait) */
|
||||||
|
|
||||||
|
/* Task's CPU becomes available */
|
||||||
|
|
||||||
|
ops.dispatch(); /* task->scx.slice can be refilled */
|
||||||
}
|
}
|
||||||
|
|
||||||
ops.quiescent(); /* Task releases its assigned CPU (wait) */
|
ops.quiescent(); /* Task releases its assigned CPU (wait) */
|
||||||
|
|||||||
Reference in New Issue
Block a user