compio-rs/compio

Support of registered file descriptors

Open

#28 opened on Sep 8, 2023

 (20 comments) (0 reactions) (1 assignee)Rust (120 forks)github user discovery
driver: io-uringenhancementhelp wanted

Repository metrics

Stars
 (1,732 stars)
PR merge metrics
 (Avg merge 2d 3h) (14 merged PRs in 30d)

Description

IO Uring supports registration of file descriptors. Instead of maintaining reference counts for each IO operation Linux constructs user provided indirection array for each thread.

Registration is beneficial for long lived descriptors. Refcounting overhead is relatively significant for small submit batches.

I'm personally interested in driver-level support of registered file descriptors.

I see the following approaches:

  1. define driver specific operations with registered fds. User either prefers a single platform or writes 2 IO data paths for regular and registered file descriptors. IO Uring could expose tokio-uring Fd or FixedFd, platform independent ops code wraps RawFd into Fd.
  2. define common registration interface. For platforms that don't support registration driver could maintain indirection array in userspace.
    1. separate operations for regular/registered fds, no runtime overhead (branching) at operation construction time, more duplicate code
    2. generic interface with enum and 2 newtype wrappers like in tokio-uring - regular/registered enum, macro enum handling, macro param with implicit type that wraps either regular or registered fd - less duplication, but more complex macro-based code, branching runtime overhead

Contributor guide