io_uring improvements#167
Conversation
|
Took a look at this against current
|
main |
with #167 rebased | |
|---|---|---|
select(0) empty, tight loop (200k iter, n=5) |
~56 ns/call | ~56 ns/call |
| Cross-thread wakeup roundtrip (n=12) | 11.53 µs ± 1.09 | 10.57 µs ± 0.76 |
Idle wakeup (n=12) |
1.55 µs ± 0.12 | 1.58 µs ± 0.16 |
No regression on existing benchmarks (roundtrip is within the run-to-run noise envelope I've seen for #166). The wins from these commits are correctness under error conditions — short submits, ENOMEM, SQE prep errors — which the microbenchmarks don't exercise.
3db30c7 to
b06e10c
Compare
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. Co-authored-by: Cursor <cursoragent@cursor.com>
This decreases the likelihood of a short submit. Co-authored-by: Cursor <cursoragent@cursor.com>
b06e10c to
c3f2a34
Compare
|
Thanks for your contributions! |
Some
io_uringchanges, feel free to take some or all of these.I tried also adding
IORING_SETUP_DEFER_TASKRUNbut it didn't pass the test suite, I assume because withSINGLE_ISSUERwe're waiting withppoll()instead ofio_uring_enter()(and thus some task_work never runs).Types of Changes
Contribution