Skip to content

Commit 9465f44

Browse files
arighihtejun
authored andcommitted
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 <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent 086ed90 commit 9465f44

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Documentation/scheduler/sched-ext.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,16 +313,21 @@ by a sched_ext scheduler:
313313
ops.runnable(); /* Task becomes ready to run */
314314
315315
while (task is runnable) {
316-
if (task is not in a DSQ) {
316+
if (task is not in a DSQ && task->scx.slice == 0) {
317317
ops.enqueue(); /* Task can be added to a DSQ */
318318
319-
/* A CPU becomes available */
319+
/* Any usable CPU becomes available */
320320
321321
ops.dispatch(); /* Task is moved to a local DSQ */
322322
}
323323
ops.running(); /* Task starts running on its assigned CPU */
324-
ops.tick(); /* Called every 1/HZ seconds */
324+
while (task->scx.slice > 0 && task is runnable)
325+
ops.tick(); /* Called every 1/HZ seconds */
325326
ops.stopping(); /* Task stops running (time slice expires or wait) */
327+
328+
/* Task's CPU becomes available */
329+
330+
ops.dispatch(); /* task->scx.slice can be refilled */
326331
}
327332
328333
ops.quiescent(); /* Task releases its assigned CPU (wait) */

0 commit comments

Comments
 (0)