Re: [PATCH sched_ext/for-7.1] sched_ext: Documentation: Add missing calls to quiescent(), runnable()

From: Andrea Righi

Date: Wed Apr 08 2026 - 07:29:02 EST


Hi Kuba,

On Wed, Apr 08, 2026 at 09:18:21AM +0000, Kuba Piecuch wrote:
> When a queued task has one of its scheduling properties changed
> (e.g. nice, affinity), it goes through dequeue() -> quiescent() ->
> (property change callback, e.g. ops.set_weight()) -> runnable() ->
> enqueue().
>
> The existing documentation only mentions dequeue() and enqueue() on that
> path, so add the missing callbacks.
>
> Fixes: a4f61f0a1afd ("sched_ext: Documentation: Add ops.dequeue() to task lifecycle")
> Signed-off-by: Kuba Piecuch <jpiecuch@xxxxxxxxxx>
> ---
> Documentation/scheduler/sched-ext.rst | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/Documentation/scheduler/sched-ext.rst b/Documentation/scheduler/sched-ext.rst
> index ec594ae8086de..b5c70f4cfc352 100644
> --- a/Documentation/scheduler/sched-ext.rst
> +++ b/Documentation/scheduler/sched-ext.rst
> @@ -429,6 +429,11 @@ by a sched_ext scheduler:

Looks good, but I noticed another issue, should we also change the condition up
above as following?

Documentation/scheduler/sched-ext.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/scheduler/sched-ext.rst b/Documentation/scheduler/sched-ext.rst
index 29d36e248f58b..99df4cc982375 100644
--- a/Documentation/scheduler/sched-ext.rst
+++ b/Documentation/scheduler/sched-ext.rst
@@ -423,7 +423,7 @@ by a sched_ext scheduler:
ops.runnable(); /* Task becomes ready to run */

while (task_is_runnable(task)) {
- if (task is not in a DSQ && task->scx.slice == 0) {
+ if (task is not in a DSQ || task->scx.slice == 0) {
ops.enqueue(); /* Task can be added to a DSQ */

/* Task property change (i.e., affinity, nice, etc.)? */

Because we trigger ops.enqueue() when the task expired its time slice or it
becomes runnable and has not been added to a DSQ.

This also represents correctly the sched_change() scenario: a task being
re-enqueued after sched_change() still has its time slice > 0, but we need to
call ops.enqueue() for it.

Thanks,
-Andrea

> /* Task property change (i.e., affinity, nice, etc.)? */
> if (sched_change(task)) {
> ops.dequeue(); /* Exiting BPF scheduler custody */
> + ops.quiescent();
> +
> + /* Property change callback, e.g. ops.set_weight() */
> +
> + ops.runnable();
> continue;
> }
> }
> --
> 2.53.0.1213.gd9a14994de-goog
>