Flush deferred SQEs before parking#102
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses a scheduler idle-path issue where transient io_uring_submit deferrals (e.g., -EBUSY/-EAGAIN) could leave SQEs queued with no subsequent submit occurring before the thread parks, delaying doorbell rearm / MSG_RING wakeups / remote cancels until unrelated activity occurs.
Changes:
- Flushes deferred SQEs by calling
submitIo(true)immediately before parking the scheduler thread. - Refactors SQ/CQ “ready” counter reads into
sqReady()/cqReady()helpers (with centralized TSan suppression) and usescqReady()inhasWork()/ CQ fast path. - Updates perf CMake logic to avoid building Poco/AWS perf targets under MSan.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/perf/CMakeLists.txt |
Skips Poco/AWS perf targets under MSan; condition changes around BUILD_POCO / BUILD_AWS. |
src/fibers/fiber.cpp |
Flushes deferred SQEs before parking; introduces sqReady()/cqReady() helpers and uses CQ readiness in hasWork() and CQ fast path. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
io_uring maintains the SQ/CQ counters with plain stores, so cross-thread reads need a TSan suppression; the TSAN_IGNORE block was copy-pasted at every read site. Wrap each counter read in a ProcessorState helper and convert all call sites.
submitIo defers on transient io_uring_submit failures (EBUSY/EAGAIN), leaving SQEs queued, and the idle path had no submit at all: a deferred doorbell rearm, MSG_RING wakeup, or remote cancel sat queued until unrelated activity landed on the ring. Flush in parkThread before sleeping; on EBUSY hasWork() sees the full CQ and skips the park, on EAGAIN the timed park is the retry backoff.
vadimskipin
force-pushed
the
vskipin/codex-review-fixes
branch
from
July 14, 2026 14:47
460821e to
2dd997e
Compare
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.
submitIo defers on transient io_uring_submit failures (EBUSY/EAGAIN),
leaving SQEs queued, and the idle path had no submit at all: a deferred
doorbell rearm, MSG_RING wakeup, or remote cancel sat queued until
unrelated activity landed on the ring. Flush in parkThread before
sleeping; on EBUSY hasWork() sees the full CQ and skips the park, on
EAGAIN the timed park is the retry backoff.