Remove SCHED_EEVDF, restore O(1) priority#12
Merged
Merged
Conversation
EEVDF's two-pass picker walked every runnable peer under pcpu_runq_lock on every dispatch, which weakens the bounded dispatch-cost invariant the hard-RT contract rests on; its cross-CPU pcpu_min_vruntime read at the idle-steal and load-balance migration sites was unsynchronized; and its fair-share semantics are not property PSE51 callers express importance through (they use priority). Removing the entire path reduces the picker to a bitmap-and-FIFO dequeue and eliminates the race. Replace the eevdf_fairness selftest with quantum_rotation_fairness: pin N CPU-bound equal-priority workers to one CPU, busy-loop on time_rdtime in each worker, and assert each worker's worst-case run-to-run latency stays within (N - 1) * quantum + jitter slack and that the worker was descheduled at least once. This exercises the timer-driven quantum expiry path that intra-band rotation actually relies on, not the voluntary-yield path the old test was inadvertently hitting via sleep_ms(0).
There was a problem hiding this comment.
1 issue found across 13 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="tests/tests-sched.c">
<violation number="1" location="tests/tests-sched.c:558">
P1: The failure path returns before canceling `dom.refill_callout`, which can leave a timer referencing stack memory after `test_sched_domain_budget()` exits.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.
| SCHED_PRIO_NORMAL, 0); | ||
| if (r.is_error) { | ||
| enable_interrupts(); | ||
| return 1; |
There was a problem hiding this comment.
P1: The failure path returns before canceling dom.refill_callout, which can leave a timer referencing stack memory after test_sched_domain_budget() exits.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At tests/tests-sched.c, line 558:
<comment>The failure path returns before canceling `dom.refill_callout`, which can leave a timer referencing stack memory after `test_sched_domain_budget()` exits.</comment>
<file context>
@@ -482,79 +482,113 @@ static i32 test_watchdog_activity(void)
+ SCHED_PRIO_NORMAL, 0);
+ if (r.is_error) {
+ enable_interrupts();
+ return 1;
+ }
}
</file context>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
EEVDF's two-pass picker walked every runnable peer under pcpu_runq_lock on every dispatch, which weakens the bounded dispatch-cost invariant the hard-RT contract rests on; its cross-CPU pcpu_min_vruntime read at the idle-steal and load-balance migration sites was unsynchronized; and its fair-share semantics are not property PSE51 callers express importance through (they use priority). Removing the entire path reduces the picker to a bitmap-and-FIFO dequeue and eliminates the race.
Replace the eevdf_fairness selftest with quantum_rotation_fairness: pin N CPU-bound equal-priority workers to one CPU, busy-loop on time_rdtime in each worker, and assert each worker's worst-case run-to-run latency stays within (N - 1) * quantum + jitter slack and that the worker was descheduled at least once. This exercises the timer-driven quantum expiry path that intra-band rotation actually relies on, not the voluntary-yield path the old test was inadvertently hitting via sleep_ms(0).
Summary by cubic
Remove EEVDF and return to O(1) priority scheduling with quantum-based FIFO rotation among equal-priority threads. This restores bounded dispatch cost, removes a cross-CPU race, and better aligns with PSE51 priority semantics.
Refactors
CONFIG_SCHED_EEVDFand all vruntime/deadline code; picker is now bitmap scan + FIFO within a priority level.SCHED_FIFO.sched_{set,get}scheduleracceptSCHED_OTHER/SCHED_RRbut always map/reportSCHED_FIFO.eevdf_fairnesswithquantum_rotation_fairness: N CPU-bound peers on one CPU must see worst-case service gaps ≤ (N−1) quanta + small jitter, and each must be descheduled at least once.Bug Fixes
Written for commit 2f260a0. Summary will update on new commits.