Repository navigation
fix: io_uring bench MEMLOCK + Criterion workflow target_tag - #3575
Merged
Merged
Conversation
The io_uring read sub-bench in fast_io/io_optimizations.rs was allocating a fresh ring (and registered-buffer group) per criterion iteration. With ~6us per read iter, the 3s warm-up + 5s measurement window allocated hundreds of thousands of rings, exhausting RLIMIT_MEMLOCK on CI runners and panicking with ENOMEM. `IoUringReader::read_all_batched` reads from offset 0 each call and returns registered-buffer slots via Drop, so the reader is safe to reuse across iterations. Hoist allocation outside `b.iter` (the allocation also doubles as the existing sentinel guard). The writer sub-bench has the same per-iter allocation pattern, but the writer owns its file with an internal cursor -- cross-iter reuse would grow the file unboundedly. Apply a defensive iteration bound via reduced sample_size and warm_up/measurement times instead. Failure observed in run 25276974185 at io_optimizations.rs:204 during warm-up of io_uring/io_uring/64kb.
Mirror the target_tag dispatch pattern from benchmark.yml (PR #3574) so the Criterion workflow can be re-run against an existing release tag (e.g. v0.6.1) without requiring a tag push. Adds: - workflow_dispatch input target_tag - Resolve release tag step that prefers the dispatch input over the push ref - Updated gates and TAG bindings on Append criterion summary and Upload criterion results to use the resolved tag Required when the original tag-triggered Criterion run failed (e.g. v0.6.1 panicked on RLIMIT_MEMLOCK exhaustion) so the rebuilt benchmark output can be appended to the already-published release notes without retagging.
3 tasks done
oferchen
added a commit
that referenced
this pull request
May 3, 2026
The io_uring write benchmark allocated a fresh ring inside `b.iter()` via `IoUringWriter::create`, which on CI runners exhausts RLIMIT_MEMLOCK (each ring + registered buffers locks ~512 KB). When the writer bench runs immediately after the reader bench, the kernel has not yet reclaimed the reader's MEMLOCK pages, and the very first writer iteration panics with `ENOMEM` from `io_uring_setup()`. Hoist `IoUringWriter::create` outside `b.iter()` and reuse the ring across iterations via `writer.write_all_batched(data, 0)`. This public method takes an explicit offset and bypasses the internal write cursor, so writing to offset 0 every iteration overwrites the file in place rather than growing it -- so cross-iter reuse is safe. Same pattern as PR #3575 used for the reader. Removes the defensive `sample_size`/`warm_up_time`/`measurement_time` bounds from PR #3575 since they are no longer needed: with one ring per sub-benchmark we are now within RLIMIT_MEMLOCK regardless of iter count. Unblocks the Criterion Benchmarks workflow on the v0.6.1 release.
oferchen
added a commit
that referenced
this pull request
May 5, 2026
* fix(bench): hoist io_uring reader to prevent MEMLOCK exhaustion The io_uring read sub-bench in fast_io/io_optimizations.rs was allocating a fresh ring (and registered-buffer group) per criterion iteration. With ~6us per read iter, the 3s warm-up + 5s measurement window allocated hundreds of thousands of rings, exhausting RLIMIT_MEMLOCK on CI runners and panicking with ENOMEM. `IoUringReader::read_all_batched` reads from offset 0 each call and returns registered-buffer slots via Drop, so the reader is safe to reuse across iterations. Hoist allocation outside `b.iter` (the allocation also doubles as the existing sentinel guard). The writer sub-bench has the same per-iter allocation pattern, but the writer owns its file with an internal cursor -- cross-iter reuse would grow the file unboundedly. Apply a defensive iteration bound via reduced sample_size and warm_up/measurement times instead. Failure observed in run 25276974185 at io_optimizations.rs:204 during warm-up of io_uring/io_uring/64kb. * fix(ci): allow Criterion workflow to publish to existing release tag Mirror the target_tag dispatch pattern from benchmark.yml (PR #3574) so the Criterion workflow can be re-run against an existing release tag (e.g. v0.6.1) without requiring a tag push. Adds: - workflow_dispatch input target_tag - Resolve release tag step that prefers the dispatch input over the push ref - Updated gates and TAG bindings on Append criterion summary and Upload criterion results to use the resolved tag Required when the original tag-triggered Criterion run failed (e.g. v0.6.1 panicked on RLIMIT_MEMLOCK exhaustion) so the rebuilt benchmark output can be appended to the already-published release notes without retagging.
oferchen
added a commit
that referenced
this pull request
May 5, 2026
The io_uring write benchmark allocated a fresh ring inside `b.iter()` via `IoUringWriter::create`, which on CI runners exhausts RLIMIT_MEMLOCK (each ring + registered buffers locks ~512 KB). When the writer bench runs immediately after the reader bench, the kernel has not yet reclaimed the reader's MEMLOCK pages, and the very first writer iteration panics with `ENOMEM` from `io_uring_setup()`. Hoist `IoUringWriter::create` outside `b.iter()` and reuse the ring across iterations via `writer.write_all_batched(data, 0)`. This public method takes an explicit offset and bypasses the internal write cursor, so writing to offset 0 every iteration overwrites the file in place rather than growing it -- so cross-iter reuse is safe. Same pattern as PR #3575 used for the reader. Removes the defensive `sample_size`/`warm_up_time`/`measurement_time` bounds from PR #3575 since they are no longer needed: with one ring per sub-benchmark we are now within RLIMIT_MEMLOCK regardless of iter count. Unblocks the Criterion Benchmarks workflow on the v0.6.1 release.
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.
Two release-blocker fixes for the v0.6.1 Criterion publishing pipeline.
fix(bench): hoist io_uring reader to prevent MEMLOCK exhaustion
The v0.6.1 Criterion workflow (run 25276974185) panicked with
Cannot allocate memory (os error 12)duringio_uring/io_uring/64kbwarm-up. Per-iterationIoUringReader::openallocates a fresh ring; at ~6us/iter across 3s warm-up + 5s measurement, hundreds of thousands of ring allocations exhaustRLIMIT_MEMLOCKon CI runners.Fix:
IoUringReaderallocation outsideb.iter.read_all_batchedreads from offset 0 each call and returns registered-buffer slots via Drop, so reuse is safe. The hoisted open also doubles as the sentinel: a failed open skips the sub-bench and keeps thestandard_iobaseline measurable.IoUringWriterowns its file with an internal byte cursor (no reset path), so cross-iter reuse is impractical. Bound the write iteration count instead viasample_size(10),warm_up_time(500ms),measurement_time(2s).fix(ci): allow Criterion workflow to publish to existing release tag
Mirrors the
target_tagdispatch pattern from benchmark.yml (PR #3574). Adds aworkflow_dispatchinput plus aResolve release tagstep so the Criterion workflow can be re-run against an existing release tag without retagging - required to publish criterion results to v0.6.1 once the bench fix above lands.Verification