Skip to content

docs(design): bound io_uring bgid u16 namespace exhaustion (#2044)#3711

Merged
oferchen merged 1 commit into
masterfrom
docs/io-uring-bgid-namespace-2044
May 5, 2026
Merged

docs(design): bound io_uring bgid u16 namespace exhaustion (#2044)#3711
oferchen merged 1 commit into
masterfrom
docs/io-uring-bgid-namespace-2044

Conversation

@oferchen
Copy link
Copy Markdown
Owner

@oferchen oferchen commented May 5, 2026

Summary

  • Documents the 16-bit bgid namespace exposed by
    IORING_REGISTER_PBUF_RING (max 65 536 distinct provided-buffer
    rings per io_uring_fd).
  • Captures the current state in crates/fast_io/src/io_uring/buffer_ring.rs:
    no central allocator, public bgid: u16 field defaulting to 0,
    no in-tree caller outside the unit tests in the same file.
  • Proposes a free-list BgidAllocator with BgidLease, generation
    counter for defence-in-depth, and a typed BgidExhausted error so
    callers can fall back to non-PBUF_RING I/O at the hard cap.
  • Cross-references the session-level ring pool design
    (docs/design/iouring-session-ring-pool.md) and the adaptive
    sizing audit (Align cross-compile matrix with build_daemon metadata #2045) as the orthogonal per-ring concern.

Why now

Today the namespace is unused because no in-tree caller constructs a
BufferRing outside its own unit tests. As soon as the session-pool
design or per-file PBUF_RING work lands, callers will start minting
bgid values. Without a recycler, a long-running daemon would hit
-EEXIST after 65 536 cumulative file transfers per io_uring fd
even though the live working set is tiny.

Doc

docs/design/io-uring-bgid-namespace.md - 434 lines, ten sections:
problem statement, current allocation policy, current safety net,
theoretical thresholds, realistic scenarios, recycler design, hard
cap and fallback, test strategy, cross-reference to #2045, open
questions.

Test plan

  • grep -ni -E 'claude|internal|internal docs\.md' docs/design/io-uring-bgid-namespace.md returns empty.
  • grep -nE '—|–' docs/design/io-uring-bgid-namespace.md returns empty.
  • Markdown renders cleanly in the GitHub diff viewer.
  • CI: docs-only change; expect fmt+clippy and nextest to be
    unaffected by the doc.

Document the 16-bit io_uring buffer-group-id namespace surface, the
absence of an in-tree allocator today, theoretical and practical
exhaustion bounds, a free-list recycler proposal with generation
guard, hard-cap fallback to non-PBUF_RING I/O, and the unit and
integration test plan. Cross-references #2045 adaptive sizing as the
orthogonal per-ring concern.
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label May 5, 2026
@oferchen oferchen merged commit 8e526f2 into master May 5, 2026
8 checks passed
@oferchen oferchen deleted the docs/io-uring-bgid-namespace-2044 branch May 6, 2026 18:57
oferchen added a commit that referenced this pull request May 18, 2026
…3711)

Document the 16-bit io_uring buffer-group-id namespace surface, the
absence of an in-tree allocator today, theoretical and practical
exhaustion bounds, a free-list recycler proposal with generation
guard, hard-cap fallback to non-PBUF_RING I/O, and the unit and
integration test plan. Cross-references #2045 adaptive sizing as the
orthogonal per-ring concern.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant