feat(sched): the I/O-priority boost — COM2/IPC latency fix (ADR-0022 epic) - #225
Merged
Conversation
…epic) The deferred principled fix from ADR-0022's option table: a process whose awaited I/O just arrived (IPC delivery, or COM2 RX for the registered holder) is flagged io_boost and picked out of turn at the next reschedule — collapsing a hop from ~one round-robin rotation (~450ms at rest) to tick-detect + one quantum remainder. Hardened by a 4-lens adversarial design panel (31 findings: 7 blockers, 15 majors, all folded in): - sticky 0xFF absent-device latch: an unbacked COM2 port reads all-ones, so without it the boost fires every tick of every COM2-less boot (nearly the whole functional CI suite) - SCHED_BOOST_MAX_CONSEC=2: a boost ping-pong would monopolize every yield-path reschedule AND keep quantum expiry from ever firing — starving the roster invisibly to every liveness floor - pick_next stays PURE (it is a bare predicate in the CPUKILL pre-check and called twice on the kill path); the flag is consumed only at the dispatch COMMIT in scheduler_reschedule/scheduler_kill_current - COM2 holder registered as (pid, generation) + live-cap-validated at the boost site + cleared in process_destroy (a bare pid would boost whatever recycles it — the ADR-0023 lesson) - boost_count counts HONORED picks at the commit (a set-side counter is the switch_count vacuity trap); exposed as trailing ' boost=' on the SYSINFO_SCHED line (prefix-safe for old parsers) - ipc_send boost-set in its OWN irq bracket (it had none) for the documented IF=1 kernel-thread-sender pattern - default round-robin arm only; RESONANT/LOTTERY untouched - SCHED_IO_BOOST 0 restores the exact pre-epic pick behavior (the revert-confirm flag) Gates re-armed in the same increment (the fix is only as real as they are): - ci-smoke-latency: PING median < 0.30s over n=9 (boost-off phase-locks to the full rotation >=~0.45s on any host — fail-side structural) AND honored-boost delta > 0 (binds effect to mechanism; a bare median is gameable by a quantum change the sched gate deliberately tolerates); STATUS armed at < 0.6s median with a 3-of-5 success floor - ci-smoke-sched: LOAD ping loop paced at fixed 0.5s cadence (boost- invariant load profile) + armed max_gap <= 600 ticks starvation ceiling — the only metric that can referee the boost's fairness guard ADR-0022 updated: the deferred epic is implemented. Co-Authored-By: Claude Fable 5 <[email protected]>
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.
Implements ADR-0022's deferred epic — the I/O-priority boost, the option table's principled fix. A process whose awaited I/O just arrived (IPC delivery to its mailbox, or a COM2 RX byte for the registered holder) is flagged
io_boostand picked out of turn at the next reschedule — collapsing a hop from ~one round-robin rotation (~450ms) to tick-detect + one quantum remainder.Measured result (WSL, gates armed in this PR)
Every agent-facing MCP tool call (
qos_status,qos_qpu_submit, attestation) rides this wire.Design (hardened by a 4-lens adversarial panel: 31 findings — 7 blockers, 15 majors — all folded in)
SCHED_BOOST_MAX_CONSEC=2starvation guard: a boost ping-pong would otherwise monopolize every yield-path reschedule AND — by resetting the quantum counter — keep quantum expiry itself from firing, starving the roster invisibly to every liveness floor.pick_nextstays pure; the flag is consumed only at the dispatch COMMIT (it is a bare predicate in the CPUKILL pre-check and called twice on the kill path — a scan-side clear would eat boosts).process_destroy(a bare pid would boost whatever recycles it — the ADR-0023 lesson).boost_countcounts HONORED picks at the commit (a set-side counter is the switch_count vacuity trap); exposed as trailingboost=on SYSINFO_SCHED (prefix-safe).SCHED_IO_BOOST 0restores the exact pre-epic pick behavior.Gates re-armed in the same PR
Four-way verification (local WSL)
SCHED_IO_BOOST 0): latency RED on both assertions (0.448s median — landing exactly on the predicted phase-locked floor — and +0 boosts); sched green (199.9 — the preempt band is structurally boost-invariant: the expiry increment precedes the pick).make ci-smokeon the boost-on kernel: 65 SUCCESS gates, PASSED (including the ADR-0023 rebirth gates).ADR-0022 updated: the deferred epic is implemented.
🤖 Generated with Claude Code