[PATCH v2 1/2] sched_ext: document the rolling-cursor requirement for dsq_vtime
From: Tao Cui
Date: Tue Sep 01 2026 - 10:34:53 EST
From: Tao Cui <cuitao@xxxxxxxxxx>
scx_bpf_dsq_insert_vtime() orders tasks by time_before64(), which is
only meaningful when the values within a given DSQ stay within a
half-range (2^63) of each other. This is implicit in how a vtime
scheduler works -- the cursor advances monotonically -- but not
spelled out anywhere. Document it so BPF scheduler authors know the
constraint.
Signed-off-by: Tao Cui <cuitao@xxxxxxxxxx>
---
kernel/sched/ext/ext.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c
index 8041c87a3562..9030962f4df1 100644
--- a/kernel/sched/ext/ext.c
+++ b/kernel/sched/ext/ext.c
@@ -8905,6 +8905,11 @@ struct scx_bpf_dsq_insert_vtime_args {
* wrapping. A numerically larger vtime may indicate an earlier position in the
* ordering and vice-versa.
*
+ * vtime is a rolling cursor and should be treated as a virtual timestamp
+ * that advances monotonically. Values used for ordering within a given DSQ
+ * should stay within half the u64 range (2^63) of each other so that
+ * time_before64() ordering remains well-defined.
+ *
* A DSQ can only be used as a FIFO or priority queue at any given time and this
* function must not be called on a DSQ which already has one or more FIFO tasks
* queued and vice-versa. Also, the built-in DSQs (SCX_DSQ_LOCAL and
--
2.43.0