Skip to content

Refactor UringEngine: Decouple submission queue push from kernel submission#616

Merged
hicder merged 1 commit intomasterfrom
hicder/avoid-unsafecell-3
Jan 2, 2026
Merged

Refactor UringEngine: Decouple submission queue push from kernel submission#616
hicder merged 1 commit intomasterfrom
hicder/avoid-unsafecell-3

Conversation

@hicder
Copy link
Owner

@hicder hicder commented Jan 2, 2026

This change refactors the io_uring submission flow to improve thread safety and simplify the concurrency model by separating the submission queue (SQ) operations from kernel submission operations.

Changes:

  • Renamed push_and_submit() to push_to_sq() to reflect that it only adds entries to the submission queue without triggering kernel submission
  • Moved kernel submission (submitter.submit()) into wait_for_completion(), where it's called before cq.sync() to ensure pending submissions are sent
  • Updated all call sites to use the new push_to_sq() method

Rationale:

  • The previous architecture submitted I/O operations to the kernel immediately after pushing to the submission queue, which required careful locking semantics
  • By deferring kernel submission until the completion queue is polled, we ensure that submissions are batched more efficiently
  • This change continues the ongoing work to remove UnsafeCell usage and improve the thread safety of the io_uring engine
  • The new flow is simpler: push to SQ → wait for completions → submit any pending operations to kernel → check completion queue

This is part of the series of commits to refactor UringEngine and eliminate UnsafeCell, following the pattern established in #614 and #615.

…ission

This change refactors the io_uring submission flow to improve thread safety
and simplify the concurrency model by separating the submission queue (SQ)
operations from kernel submission operations.

Changes:
- Renamed `push_and_submit()` to `push_to_sq()` to reflect that it only adds
  entries to the submission queue without triggering kernel submission
- Moved kernel submission (`submitter.submit()`) into `wait_for_completion()`,
  where it's called before `cq.sync()` to ensure pending submissions are sent
- Updated all call sites to use the new `push_to_sq()` method

Rationale:
- The previous architecture submitted I/O operations to the kernel immediately
  after pushing to the submission queue, which required careful locking semantics
- By deferring kernel submission until the completion queue is polled, we ensure
  that submissions are batched more efficiently
- This change continues the ongoing work to remove UnsafeCell usage and improve
  the thread safety of the io_uring engine
- The new flow is simpler: push to SQ → wait for completions → submit any
  pending operations to kernel → check completion queue

This is part of the series of commits to refactor UringEngine and eliminate
UnsafeCell, following the pattern established in #614 and #615.
@hicder hicder merged commit 9b206d4 into master Jan 2, 2026
4 checks passed
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.

1 participant