* [PATCH sched_ext/for-7.1] sched_ext: Documentation: Add ops.dequeue() to task lifecycle
@ 2026-04-06 11:47 Andrea Righi
2026-04-06 14:49 ` Emil Tsalapatis
2026-04-06 18:09 ` Tejun Heo
0 siblings, 2 replies; 4+ messages in thread
From: Andrea Righi @ 2026-04-06 11:47 UTC (permalink / raw)
To: Tejun Heo, David Vernet, Changwoo Min
Cc: Christian Loehle, Kuba Piecuch, Emil Tsalapatis, sched-ext,
linux-kernel
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.
Fixes: ebf1ccff79c4 ("sched_ext: Fix ops.dequeue() semantics")
Signed-off-by: Andrea Righi <arighi@nvidia.com>
---
Documentation/scheduler/sched-ext.rst | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/Documentation/scheduler/sched-ext.rst b/Documentation/scheduler/sched-ext.rst
index 404b4e4c33f7e..9f03650abfeba 100644
--- a/Documentation/scheduler/sched-ext.rst
+++ b/Documentation/scheduler/sched-ext.rst
@@ -422,23 +422,29 @@ by a sched_ext scheduler:
ops.runnable(); /* Task becomes ready to run */
- while (task is runnable) {
+ while (task_is_runnable(task)) {
if (task is not in a DSQ && task->scx.slice == 0) {
ops.enqueue(); /* Task can be added to a DSQ */
- /* Any usable CPU becomes available */
+ /* Task property change (i.e., affinity, nice, etc.)? */
+ if (sched_change(task)) {
+ ops.dequeue(); /* Exiting BPF scheduler custody */
+ continue;
+ }
+ }
- ops.dispatch(); /* Task is moved to a local DSQ */
+ /* Any usable CPU becomes available */
+
+ ops.dispatch(); /* Task is moved to a local DSQ */
+ ops.dequeue(); /* Exiting BPF scheduler custody */
- ops.dequeue(); /* Exiting BPF scheduler */
- }
ops.running(); /* Task starts running on its assigned CPU */
- while task_is_runnable(p) {
- while (task->scx.slice > 0 && task_is_runnable(p))
- ops.tick(); /* Called every 1/HZ seconds */
+ while (task_is_runnable(task) && task->scx.slice > 0) {
+ ops.tick(); /* Called every 1/HZ seconds */
- ops.dispatch(); /* task->scx.slice can be refilled */
+ if (task->scx.slice == 0)
+ ops.dispatch(); /* task->scx.slice can be refilled */
}
ops.stopping(); /* Task stops running (time slice expires or wait) */
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH sched_ext/for-7.1] sched_ext: Documentation: Add ops.dequeue() to task lifecycle
2026-04-06 11:47 [PATCH sched_ext/for-7.1] sched_ext: Documentation: Add ops.dequeue() to task lifecycle Andrea Righi
@ 2026-04-06 14:49 ` Emil Tsalapatis
2026-04-06 19:08 ` Andrea Righi
2026-04-06 18:09 ` Tejun Heo
1 sibling, 1 reply; 4+ messages in thread
From: Emil Tsalapatis @ 2026-04-06 14:49 UTC (permalink / raw)
To: Andrea Righi, Tejun Heo, David Vernet, Changwoo Min
Cc: Christian Loehle, Kuba Piecuch, Emil Tsalapatis, sched-ext,
linux-kernel
On Mon Apr 6, 2026 at 7:47 AM EDT, Andrea Righi wrote:
> 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.
>
> Fixes: ebf1ccff79c4 ("sched_ext: Fix ops.dequeue() semantics")
Is the Fixes: tag appropriate here? It's not like the original patch
introduced a bug by fixing ops.dequeue().
Otherwise the state machine looks fine to me!
Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
> Signed-off-by: Andrea Righi <arighi@nvidia.com>
> ---
> Documentation/scheduler/sched-ext.rst | 24 +++++++++++++++---------
> 1 file changed, 15 insertions(+), 9 deletions(-)
>
> diff --git a/Documentation/scheduler/sched-ext.rst b/Documentation/scheduler/sched-ext.rst
> index 404b4e4c33f7e..9f03650abfeba 100644
> --- a/Documentation/scheduler/sched-ext.rst
> +++ b/Documentation/scheduler/sched-ext.rst
> @@ -422,23 +422,29 @@ by a sched_ext scheduler:
>
> ops.runnable(); /* Task becomes ready to run */
>
> - while (task is runnable) {
> + while (task_is_runnable(task)) {
> if (task is not in a DSQ && task->scx.slice == 0) {
> ops.enqueue(); /* Task can be added to a DSQ */
>
> - /* Any usable CPU becomes available */
> + /* Task property change (i.e., affinity, nice, etc.)? */
> + if (sched_change(task)) {
> + ops.dequeue(); /* Exiting BPF scheduler custody */
> + continue;
> + }
> + }
>
> - ops.dispatch(); /* Task is moved to a local DSQ */
> + /* Any usable CPU becomes available */
> +
> + ops.dispatch(); /* Task is moved to a local DSQ */
> + ops.dequeue(); /* Exiting BPF scheduler custody */
>
> - ops.dequeue(); /* Exiting BPF scheduler */
> - }
> ops.running(); /* Task starts running on its assigned CPU */
>
> - while task_is_runnable(p) {
> - while (task->scx.slice > 0 && task_is_runnable(p))
> - ops.tick(); /* Called every 1/HZ seconds */
> + while (task_is_runnable(task) && task->scx.slice > 0) {
> + ops.tick(); /* Called every 1/HZ seconds */
>
> - ops.dispatch(); /* task->scx.slice can be refilled */
> + if (task->scx.slice == 0)
> + ops.dispatch(); /* task->scx.slice can be refilled */
> }
>
> ops.stopping(); /* Task stops running (time slice expires or wait) */
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH sched_ext/for-7.1] sched_ext: Documentation: Add ops.dequeue() to task lifecycle
2026-04-06 14:49 ` Emil Tsalapatis
@ 2026-04-06 19:08 ` Andrea Righi
0 siblings, 0 replies; 4+ messages in thread
From: Andrea Righi @ 2026-04-06 19:08 UTC (permalink / raw)
To: Emil Tsalapatis
Cc: Tejun Heo, David Vernet, Changwoo Min, Christian Loehle,
Kuba Piecuch, sched-ext, linux-kernel
Hi Emil,
On Mon, Apr 06, 2026 at 10:49:18AM -0400, Emil Tsalapatis wrote:
> On Mon Apr 6, 2026 at 7:47 AM EDT, Andrea Righi wrote:
> > 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.
> >
> > Fixes: ebf1ccff79c4 ("sched_ext: Fix ops.dequeue() semantics")
>
> Is the Fixes: tag appropriate here? It's not like the original patch
> introduced a bug by fixing ops.dequeue().
Yeah, the intent here was to make sure this commit isn't applied without
ebf1ccff79c4 (otherwise the state machine would be inaccurate), but that
shouldn't happen, so it's probably reasonable to drop the Fixes line.
Thanks,
-Andrea
>
> Otherwise the state machine looks fine to me!
>
> Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
>
> > Signed-off-by: Andrea Righi <arighi@nvidia.com>
> > ---
> > Documentation/scheduler/sched-ext.rst | 24 +++++++++++++++---------
> > 1 file changed, 15 insertions(+), 9 deletions(-)
> >
> > diff --git a/Documentation/scheduler/sched-ext.rst b/Documentation/scheduler/sched-ext.rst
> > index 404b4e4c33f7e..9f03650abfeba 100644
> > --- a/Documentation/scheduler/sched-ext.rst
> > +++ b/Documentation/scheduler/sched-ext.rst
> > @@ -422,23 +422,29 @@ by a sched_ext scheduler:
> >
> > ops.runnable(); /* Task becomes ready to run */
> >
> > - while (task is runnable) {
> > + while (task_is_runnable(task)) {
> > if (task is not in a DSQ && task->scx.slice == 0) {
> > ops.enqueue(); /* Task can be added to a DSQ */
> >
> > - /* Any usable CPU becomes available */
> > + /* Task property change (i.e., affinity, nice, etc.)? */
> > + if (sched_change(task)) {
> > + ops.dequeue(); /* Exiting BPF scheduler custody */
> > + continue;
> > + }
> > + }
> >
> > - ops.dispatch(); /* Task is moved to a local DSQ */
> > + /* Any usable CPU becomes available */
> > +
> > + ops.dispatch(); /* Task is moved to a local DSQ */
> > + ops.dequeue(); /* Exiting BPF scheduler custody */
> >
> > - ops.dequeue(); /* Exiting BPF scheduler */
> > - }
> > ops.running(); /* Task starts running on its assigned CPU */
> >
> > - while task_is_runnable(p) {
> > - while (task->scx.slice > 0 && task_is_runnable(p))
> > - ops.tick(); /* Called every 1/HZ seconds */
> > + while (task_is_runnable(task) && task->scx.slice > 0) {
> > + ops.tick(); /* Called every 1/HZ seconds */
> >
> > - ops.dispatch(); /* task->scx.slice can be refilled */
> > + if (task->scx.slice == 0)
> > + ops.dispatch(); /* task->scx.slice can be refilled */
> > }
> >
> > ops.stopping(); /* Task stops running (time slice expires or wait) */
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH sched_ext/for-7.1] sched_ext: Documentation: Add ops.dequeue() to task lifecycle
2026-04-06 11:47 [PATCH sched_ext/for-7.1] sched_ext: Documentation: Add ops.dequeue() to task lifecycle Andrea Righi
2026-04-06 14:49 ` Emil Tsalapatis
@ 2026-04-06 18:09 ` Tejun Heo
1 sibling, 0 replies; 4+ messages in thread
From: Tejun Heo @ 2026-04-06 18:09 UTC (permalink / raw)
To: Andrea Righi, David Vernet, Changwoo Min
Cc: Christian Loehle, Kuba Piecuch, Emil Tsalapatis, sched-ext,
linux-kernel
> sched_ext: Documentation: Add ops.dequeue() to task lifecycle
Applied to sched_ext/for-7.1 with Emil's Reviewed-by added and the
Fixes: tag dropped per his comment.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-04-06 19:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-06 11:47 [PATCH sched_ext/for-7.1] sched_ext: Documentation: Add ops.dequeue() to task lifecycle Andrea Righi
2026-04-06 14:49 ` Emil Tsalapatis
2026-04-06 19:08 ` Andrea Righi
2026-04-06 18:09 ` Tejun Heo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox