Skip to content

io_uring improvements#167

Open
tavianator wants to merge 3 commits intosocketry:mainfrom
tavianator:io-uring-improvements
Open

io_uring improvements#167
tavianator wants to merge 3 commits intosocketry:mainfrom
tavianator:io-uring-improvements

Conversation

@tavianator
Copy link
Copy Markdown

Some io_uring changes, feel free to take some or all of these.

I tried also adding IORING_SETUP_DEFER_TASKRUN but it didn't pass the test suite, I assume because with SINGLE_ISSUER we're waiting with ppoll() instead of io_uring_enter() (and thus some task_work never runs).

  • Handle short io_uring submissions
  • Try setting up io_uring with IORING_SETUP_SUBMIT_ALL
  • Use IORING_SETUP_SINGLE_ISSUER if possible

Types of Changes

  • Performance improvement.
  • Maintenance.

Contribution

tavianator added 3 commits May 8, 2026 08:50
io_uring does not necessarily submit all the pending SQEs when you call
io_uring_submit().  In particular, in the default configuration, an
error while processing an SQE will cause the rest of the batch to be
aborted.  Even with IORING_SETUP_SUBMIT_ALL, some errors (like ENOMEM)
will still lead to a short submit.

Fix the accounting to keep selector->pending equal to the number of
unsubmitted SQEs at all times, so that the entire queue can be flushed
reliably.
This decreases the likelihood of a short submit.
This io_uring setup flag enables some kernel optimizations, but it also
means we can't have wakeup() send a nop from a different thread.
Instead, register an eventfd with the ring which we can wait on and wake
remotely.
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