Skip to content

register the ring fd (IORING_REGISTER_RING_FDS) to skip per-enter fdget/fdput #98

Description

@MDA2AV

Severity: low — one small fixed cost per loop tick; essentially free to remove.

Problem

Every io_uring_enter resolves and refcounts the ring fd itself (fdget/fdput) before doing any work. That's once per loop tick on the hottest syscall in the process.

Suggested fix

IORING_REGISTER_RING_FDS (register opcode 20, kernel 5.18+) hands back a registered ring index; passing that index as the fd argument together with IORING_ENTER_REGISTERED_RING (1u << 4) in the enter flags skips the per-syscall lookup/refcount. liburing does this by default for rings it creates.

Details:

  • Register once on the reactor thread right after Ring.Create; unregister (IORING_UNREGISTER_RING_FDS, opcode 21) before close in Dispose, on the owning thread like the rest of the single-issuer teardown.
  • Same fget/fput-elimination theme as perf: adopt direct descriptors (registered file table) for accepted sockets #91 — this is the enter-path edition, and much smaller, but it's a one-flag change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions