* [PATCH] sched_ext: Documentation: Clarify time slice handling in task lifecycle
@ 2025-06-09 16:23 Andrea Righi
2025-06-09 16:29 ` Tejun Heo
0 siblings, 1 reply; 2+ messages in thread
From: Andrea Righi @ 2025-06-09 16:23 UTC (permalink / raw)
To: Tejun Heo, David Vernet, Changwoo Min
Cc: Jonathan Corbet, Emily Soto, linux-kernel
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>
---
Documentation/scheduler/sched-ext.rst | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/Documentation/scheduler/sched-ext.rst b/Documentation/scheduler/sched-ext.rst
index a1869c38046ed..404fe6126a769 100644
--- a/Documentation/scheduler/sched-ext.rst
+++ b/Documentation/scheduler/sched-ext.rst
@@ -313,16 +313,21 @@ by a sched_ext scheduler:
ops.runnable(); /* Task becomes ready to run */
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 */
- /* A CPU becomes available */
+ /* Any usable CPU becomes available */
ops.dispatch(); /* Task is moved to a local DSQ */
}
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) */
+
+ /* Task's CPU becomes available */
+
+ ops.dispatch(); /* task->scx.slice can be refilled */
}
ops.quiescent(); /* Task releases its assigned CPU (wait) */
--
2.49.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] sched_ext: Documentation: Clarify time slice handling in task lifecycle
2025-06-09 16:23 [PATCH] sched_ext: Documentation: Clarify time slice handling in task lifecycle Andrea Righi
@ 2025-06-09 16:29 ` Tejun Heo
0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2025-06-09 16:29 UTC (permalink / raw)
To: Andrea Righi
Cc: David Vernet, Changwoo Min, Jonathan Corbet, Emily Soto,
linux-kernel
On Mon, Jun 09, 2025 at 06:23:42PM +0200, Andrea Righi wrote:
> 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>
Applied to sched_ext/for-6.17.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-06-09 16:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-09 16:23 [PATCH] sched_ext: Documentation: Clarify time slice handling in task lifecycle Andrea Righi
2025-06-09 16:29 ` Tejun Heo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).