docs(roadmap): register-to-park is a NoPreempt region; log the timeout-delay siblings
Gotcha: RunningNotified only covers a wake that lands while the waiter is still Running. A waiter preempted between begin_wait and park_current is Queued, and unpark on a Queued word is a no-op, so the NoPreempt guard is what makes the window safe (the select fix in the previous commit). Medium-priority item: recv_timeout and Mutex::lock_timeout have the same shape without the guard; their wake is delayed to the timeout rather than lost. Not fixed here.
This commit is contained in:
+17
@@ -215,6 +215,15 @@ turns idle into periodic wakeups), or (b) park the branch on a condvar/futex
|
|||||||
the AllDone path signals — and at that point consider making the condvar the
|
the AllDone path signals — and at that point consider making the condvar the
|
||||||
idle primitive for the no-io runtime generally (a cross-thread unpark could
|
idle primitive for the no-io runtime generally (a cross-thread unpark could
|
||||||
signal it too, see below). Decide before any no-io deployment.
|
signal it too, see below). Decide before any no-io deployment.
|
||||||
|
#### Wake delayed to timeout: `recv_timeout`, `lock_timeout`
|
||||||
|
Same register-then-`insert_wait_timer`-then-park shape as the pre-fix `select`
|
||||||
|
paths, without `NoPreempt`. The wake isn't lost outright (the timer still
|
||||||
|
fires) but a send or grant landing in the window waits out the whole timeout;
|
||||||
|
for `Mutex::lock_timeout` that leaves the lock held-but-unused and stalls
|
||||||
|
every other waiter too. `insert_wait_timer` also allocates under the `timers`
|
||||||
|
mutex. Fix per site is the `select` one; to close the class, either give
|
||||||
|
`begin_wait` a guard-returning form, or let `unpark` on a Queued word with a
|
||||||
|
matching epoch record the notification so the next park returns at once.
|
||||||
#### Cross-thread unpark
|
#### Cross-thread unpark
|
||||||
`RuntimeInner::enqueue` does not wake idle sibling schedulers — only io
|
`RuntimeInner::enqueue` does not wake idle sibling schedulers — only io
|
||||||
completions write the wake pipe. Mid-flight this is masked (the enqueuing
|
completions write the wake pipe. Mid-flight this is masked (the enqueuing
|
||||||
@@ -342,6 +351,14 @@ outright — `join` what you need finished. No forcing sweep follows.
|
|||||||
waker, decide which form it is — if its registration handle can outlive
|
waker, decide which form it is — if its registration handle can outlive
|
||||||
the wait it was created for, it MUST be epoch-stamped; a wait that can
|
the wait it was created for, it MUST be epoch-stamped; a wait that can
|
||||||
exit without parking MUST `retire_wait` first (see slot_state.rs).
|
exit without parking MUST `retire_wait` first (see slot_state.rs).
|
||||||
|
- **Register-to-park is a `NoPreempt` region.** From `begin_wait` through
|
||||||
|
`park_current`, hold `NoPreempt` (as `wait_fd`, `sleep`, `block_on_io` and
|
||||||
|
both `select` paths do). `RunningNotified` absorbs a wake that lands while
|
||||||
|
the waiter is still *Running*; a waiter preempted in the window is *Queued*,
|
||||||
|
and `unpark` on a Queued word is a no-op. A one-shot registration (an fd
|
||||||
|
arm) consumed there is a lost wake: the waiter parks with nothing left to
|
||||||
|
wake it but its timer, if it has one. Allocation is a preemption point, so
|
||||||
|
"nothing in between can yield" is not a safe assumption without the guard.
|
||||||
- **`select` exists; a unified per-process mailbox still does not.** The
|
- **`select` exists; a unified per-process mailbox still does not.** The
|
||||||
supervisor keeps its single `supervisor_channel` funnel; `recv_match`
|
supervisor keeps its single `supervisor_channel` funnel; `recv_match`
|
||||||
stays per-channel. `select` composes channels at the wait, not into one
|
stays per-channel. `select` composes channels at the wait, not into one
|
||||||
|
|||||||
Reference in New Issue
Block a user