Skip to content

Flush deferred SQEs before parking#102

Merged
vadimskipin merged 2 commits into
mainfrom
vskipin/codex-review-fixes
Jul 14, 2026
Merged

Flush deferred SQEs before parking#102
vadimskipin merged 2 commits into
mainfrom
vskipin/codex-review-fixes

Conversation

@vadimskipin

Copy link
Copy Markdown
Collaborator

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.

@praktika-gh

praktika-gh Bot commented Jul 14, 2026

Copy link
Copy Markdown

Workflow [PR], commit [2dd997e]

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 uses cqReady() in hasWork() / 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.

Comment thread src/perf/CMakeLists.txt Outdated
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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@vadimskipin
vadimskipin merged commit 922f51a into main Jul 14, 2026
16 checks passed
@vadimskipin
vadimskipin deleted the vskipin/codex-review-fixes branch July 14, 2026 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants