Skip to contentSkip to conversation

sched_ext: Documentation: add note about multiple ops.enqueue() calls in a row

PATCH Superseded Kuba Piecuch 3 participants 5 messages Apr 20

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched_ext: Documentation: add note about multiple ops.enqueue() calls in a row

Commit 84b1a0ea0b7c
("sched_ext: Implement scx_bpf_dsq_reenq() for user DSQs") introduced the possibility of ops.enqueue() being called multiple times in a row for the same task without intervening calls to ops.dequeue(). AFAIK this was not possible before that commit.
Document this behavior as it may be surprising to some.

---
 Documentation/scheduler/sched-ext.rst | 5 +++++
 1 file changed, 5 insertions(+)
Documentation/scheduler/sched-ext.rst +5 -0
index 03d595d178ea..fba09aa1cd4e 100644
@@ -339,6 +339,11 @@ The following briefly shows how a waking task is scheduled and executed.
      leaves (e.g., when ``ops.dispatch()`` moves it to a terminal DSQ, or
      on property change / sleep).
 
+   Note that ``ops.enqueue()`` can be called multiple times in a row without
+   an intervening call to ``ops.dequeue()``. This can happen, for example,
+   when a task on a user-created DSQ is re-enqueued using
+   ``scx_bpf_dsq_reenq()``. The task stays in BPF custody the entire time.
+
    When a task leaves BPF scheduler custody, ``ops.dequeue()`` is invoked.
    The dequeue can happen for different reasons, distinguished by flags:
 
Signature · 1 line
2.54.0.rc1.555.g9c883467ad-goog
reviewer Acked-by on v1 1/1
#1 lore raw

Hi Kuba,

Quoted 8 lines · Kuba Piecuch

Commit 84b1a0ea0b7c
("sched_ext: Implement scx_bpf_dsq_reenq() for user DSQs") introduced the possibility of ops.enqueue() being called multiple times in a row for the same task without intervening calls to ops.dequeue(). AFAIK this was not possible before that commit.
Document this behavior as it may be surprising to some.

Looks good to me and I think it's good to document this special case.

Thanks,
-Andrea

Quoted 23 lines
---
 Documentation/scheduler/sched-ext.rst | 5 +++++
 1 file changed, 5 insertions(+)
Documentation/scheduler/sched-ext.rst +5 -0
index 03d595d178ea..fba09aa1cd4e 100644
@@ -339,6 +339,11 @@ The following briefly shows how a waking task is scheduled and executed.
      leaves (e.g., when ``ops.dispatch()`` moves it to a terminal DSQ, or
      on property change / sleep).
 
+   Note that ``ops.enqueue()`` can be called multiple times in a row without
+   an intervening call to ``ops.dequeue()``. This can happen, for example,
+   when a task on a user-created DSQ is re-enqueued using
+   ``scx_bpf_dsq_reenq()``. The task stays in BPF custody the entire time.
+
    When a task leaves BPF scheduler custody, ``ops.dequeue()`` is invoked.
    The dequeue can happen for different reasons, distinguished by flags:
 
Signature · 1 line
2.54.0.rc1.555.g9c883467ad-goog
Acked-by on v1 1/1
#2 lore raw
In reply to Kuba Piecuch

Hi Kuba,

Quoted 5 lines · Kuba Piecuch

Commit 84b1a0ea0b7c
("sched_ext: Implement scx_bpf_dsq_reenq() for user DSQs") introduced the possibility of ops.enqueue() being called multiple times in a row for the same task without intervening calls to ops.dequeue(). AFAIK this was not possible before that commit.

^^^^^
Nit: Do we really need this line in the commit message? Perhaps we can just drop this?

Quoted 12 lines

Document this behavior as it may be surprising to some.

---
 Documentation/scheduler/sched-ext.rst | 5 +++++
 1 file changed, 5 insertions(+)
Documentation/scheduler/sched-ext.rst +0 -0
index 03d595d178ea..fba09aa1cd4e 100644

Documentation/scheduler/sched-ext.rst The following briefly shows how a waking task is scheduled and executed. · line 346

Quoted 8 lines
Documentation/scheduler/sched-ext.rst +5 -0
@@ -339,6 +339,11 @@ The following briefly shows how a waking task is scheduled and executed.
      leaves (e.g., when ``ops.dispatch()`` moves it to a terminal DSQ, or
      on property change / sleep).
 
+   Note that ``ops.enqueue()`` can be called multiple times in a row without
+   an intervening call to ``ops.dequeue()``. This can happen, for example,
+   when a task on a user-created DSQ is re-enqueued using
+   ``scx_bpf_dsq_reenq()``. The task stays in BPF custody the entire time.
+

Thanks for adding and clarifying this. ^v^

Quoted 6 lines
Documentation/scheduler/sched-ext.rst +0 -0
    When a task leaves BPF scheduler custody, ``ops.dequeue()`` is invoked.
    The dequeue can happen for different reasons, distinguished by flags:
 
Signature · 1 line
2.54.0.rc1.555.g9c883467ad-goog
Signature · 2 lines
Cheers,
Cheng-Yang
#3 lore raw

Hi Cheng-Yang,

Quoted 11 lines · Cheng-Yang Chou

Hi Kuba,

Quoted 5 lines · Kuba Piecuch

Commit 84b1a0ea0b7c
("sched_ext: Implement scx_bpf_dsq_reenq() for user DSQs") introduced the possibility of ops.enqueue() being called multiple times in a row for the same task without intervening calls to ops.dequeue(). AFAIK this was not possible before that commit.

^^^^^
Nit: Do we really need this line in the commit message? Perhaps we can just drop this?

I put it there just in case someone was actually aware of a scenario before that commit where we can have multiple ops.enqueue() calls in a row.

Regarding removing the line: yeah, I guess it's a bit redundant. I'll send a v2.

Quoted 24 lines
Quoted 13 lines

Document this behavior as it may be surprising to some.

---
 Documentation/scheduler/sched-ext.rst | 5 +++++
 1 file changed, 5 insertions(+)
Documentation/scheduler/sched-ext.rst +0 -0
index 03d595d178ea..fba09aa1cd4e 100644

Documentation/scheduler/sched-ext.rst The following briefly shows how a waking task is scheduled and executed. · line 346

Quoted 8 lines
Documentation/scheduler/sched-ext.rst +5 -0
@@ -339,6 +339,11 @@ The following briefly shows how a waking task is scheduled and executed.
      leaves (e.g., when ``ops.dispatch()`` moves it to a terminal DSQ, or
      on property change / sleep).
 
+   Note that ``ops.enqueue()`` can be called multiple times in a row without
+   an intervening call to ``ops.dequeue()``. This can happen, for example,
+   when a task on a user-created DSQ is re-enqueued using
+   ``scx_bpf_dsq_reenq()``. The task stays in BPF custody the entire time.
+

Thanks for adding and clarifying this. ^v^

Quoted 2 lines

Thanks,
Kuba

#4 lore raw

Hi Kuba,

Quoted 11 lines · Kuba Piecuch

Hi Cheng-Yang,

Quoted 8 lines · Cheng-Yang Chou

Hi Kuba,

Quoted 5 lines · Kuba Piecuch

Commit 84b1a0ea0b7c
("sched_ext: Implement scx_bpf_dsq_reenq() for user DSQs") introduced the possibility of ops.enqueue() being called multiple times in a row for the same task without intervening calls to ops.dequeue(). AFAIK this was not possible before that commit.

Quoted 6 lines
Quoted 3 lines

^^^^^
Nit: Do we really need this line in the commit message? Perhaps we can just drop this?

I put it there just in case someone was actually aware of a scenario before that commit where we can have multiple ops.enqueue() calls in a row.

I see, thanks!

Quoted 33 lines

Regarding removing the line: yeah, I guess it's a bit redundant. I'll send a v2.

Quoted 24 lines
Quoted 13 lines

Document this behavior as it may be surprising to some.

---
 Documentation/scheduler/sched-ext.rst | 5 +++++
 1 file changed, 5 insertions(+)
Documentation/scheduler/sched-ext.rst +0 -0
index 03d595d178ea..fba09aa1cd4e 100644

Documentation/scheduler/sched-ext.rst The following briefly shows how a waking task is scheduled and executed. · line 346

Quoted 8 lines
Documentation/scheduler/sched-ext.rst +5 -0
@@ -339,6 +339,11 @@ The following briefly shows how a waking task is scheduled and executed.
      leaves (e.g., when ``ops.dispatch()`` moves it to a terminal DSQ, or
      on property change / sleep).
 
+   Note that ``ops.enqueue()`` can be called multiple times in a row without
+   an intervening call to ``ops.dequeue()``. This can happen, for example,
+   when a task on a user-created DSQ is re-enqueued using
+   ``scx_bpf_dsq_reenq()``. The task stays in BPF custody the entire time.
+

Thanks for adding and clarifying this. ^v^

Quoted 2 lines

Thanks,
Kuba

Signature · 2 lines
Cheers,
Cheng-Yang