History

io_uring: Add io_uring_setup flag to pre-register ring fd and never install it

With IORING_REGISTER_USE_REGISTERED_RING, an application can register the ring fd and use it via registered index rather than installed fd. This allows using a registered ring for everything *except* the initial mmap. With IORING_SETUP_NO_MMAP, io_uring_setup uses buffers allocated by the user, rather than requiring a subsequent mmap. The combination of the two allows a user to operate *entirely* via a registered ring fd, making it unnecessary to ever install the fd in the first place. So, add a flag IORING_SETUP_REGISTERED_FD_ONLY to make io_uring_setup register the fd and return a registered index, without installing the fd. This allows an application to avoid touching the fd table at all, and allows a library to never even momentarily install a file descriptor. This splits out an io_ring_add_registered_file helper from io_ring_add_registered_fd, for use by io_uring_setup.

Josh Triplett committed 3 years ago

Commit 6e76ac51 parent 03d89a24 files · +52 −26Browse files

Showing the changes to include/uapi (1 of 4 files). Show all

Unified · Split

include/uapi/linux/io_uring.h+7−0
@@ -178,6 +178,13 @@ enum { · 177 unmodified lines
178178 */
179179 #define IORING_SETUP_NO_MMAP (1U << 14)
180180
181+/*
182+ * Register the ring fd in itself for use with
183+ * IORING_REGISTER_USE_REGISTERED_RING; return a registered fd index rather
184+ * than an fd.
185+ */
186+#define IORING_SETUP_REGISTERED_FD_ONLY (1U << 15)
187+
181188 enum io_uring_op {
182189 IORING_OP_NOP,
183190 IORING_OP_READV,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t