feat(fast_io): cache PBUF_RING probe and surface in --version#3635
Merged
Conversation
3 tasks
34ecbfd to
9fbc31a
Compare
Adds a process-wide `OnceLock`-cached `pbuf_ring_supported()` probe for `IORING_REGISTER_PBUF_RING` (Linux 5.19+), surfaces it on `IoUringKernelInfo::pbuf_ring_supported`, and appends `pbuf_ring=yes/no` to the `--version` reason string. The cross-platform stub mirrors the same surface and always returns `false`. The fallback chain (PBUF_RING -> classic provide-buffers -> standard read/write -> non-Linux io_uring stub) is now documented at the module level on `io_uring/buffer_ring.rs` and `io_uring/mod.rs`, and reflected in `docs/audits/iouring-pbuf-ring.md` Phase 2 status. Refs task #2043.
9fbc31a to
dc34a3d
Compare
oferchen
added a commit
that referenced
this pull request
May 18, 2026
Adds a process-wide `OnceLock`-cached `pbuf_ring_supported()` probe for `IORING_REGISTER_PBUF_RING` (Linux 5.19+), surfaces it on `IoUringKernelInfo::pbuf_ring_supported`, and appends `pbuf_ring=yes/no` to the `--version` reason string. The cross-platform stub mirrors the same surface and always returns `false`. The fallback chain (PBUF_RING -> classic provide-buffers -> standard read/write -> non-Linux io_uring stub) is now documented at the module level on `io_uring/buffer_ring.rs` and `io_uring/mod.rs`, and reflected in `docs/audits/iouring-pbuf-ring.md` Phase 2 status. Refs task #2043.
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.
Summary
Implements task #2043: probe
IORING_REGISTER_PBUF_RING(Linux 5.19+) at runtime, cache the result behindOnceLock, surface it onIoUringKernelInfo, and document the layered fallback chain in code and audit docs.OnceLock-cachedpbuf_ring_supported() -> boolprobe incrates/fast_io/src/io_uring/buffer_ring.rs, re-exported at the crate root asfast_io::pbuf_ring_supported. The first call performs auname(2)parse viaconfig_detail::get_kernel_release_string; subsequent calls are a single relaxed atomic load.IoUringKernelInfo::pbuf_ring_supported(both Linux and the cross-platform stub) and appends, pbuf_ring=yes/noto theIoUringProbeResult::Availablereason string so--versionoutput communicates which fallback tier is active.io_uring_stub.rs) mirrors the same surface and always returnsfalse; matching re-export added.io_uring/buffer_ring.rsandio_uring/mod.rs, anddocs/audits/iouring-pbuf-ring.mdupdated with the Phase 2 status note.Fallback chain
IORING_REGISTER_PBUF_RING, opcode 22) - completion-time buffer selection via ring-mapped supplied buffers.IORING_OP_PROVIDE_BUFFERSopcode 31, orIORING_REGISTER_BUFFERSopcode 0) - pre-registered pool with per-SQE selection.read(2)/write(2)-traits::StdFileReader/traits::StdFileWriterfallback used when io_uring is unavailable entirely.io_uring_stub.rs) -pbuf_ring_supported()returnsfalse;BufferRing::newreturnsErr(Unsupported);BufferRing::try_newreturnsNone.Test plan
New
crates/fast_io/tests/pbuf_ring_probe.rsadds five integration tests covering:OnceLockcaching contract).falseon non-Linux / feature-disabled builds; type-correct on Linux.pbuf_ring_supported() => is_io_uring_available()invariant (5.19+ implies the 5.6+ floor).IoUringKernelInfo::pbuf_ring_supportedmirrors the crate-root probe.CI: fmt+clippy, nextest (Linux probe path; non-Linux stub path); audit doc renders.
Refs task #2043.