History

io_uring: add io-wq workqueue sharing

If IORING_SETUP_ATTACH_WQ is set, it expects wq_fd in io_uring_params to be a valid io_uring fd io-wq of which will be shared with the newly created io_uring instance. If the flag is set but it can't share io-wq, it fails. This allows creation of "sibling" io_urings, where we prefer to keep the SQ/CQ private, but want to share the async backend to minimize the amount of overhead associated with having multiple rings that belong to the same backend.

Pavel Begunkov committed 6 years ago

Commit 24369c21 parent eba6f5a2 files · +53 −15Browse files

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

Unified · Split

include/uapi/linux/io_uring.h+3−1
@@ -75,6 +75,7 @@ enum { · 74 unmodified lines
7575 #define IORING_SETUP_SQ_AFF (1U << 2) /* sq_thread_cpu is valid */
7676 #define IORING_SETUP_CQSIZE (1U << 3) /* app defines CQ size */
7777 #define IORING_SETUP_CLAMP (1U << 4) /* clamp SQ/CQ ring sizes */
78+#define IORING_SETUP_ATTACH_WQ (1U << 5) /* attach to existing wq */
7879
7980 enum {
8081 IORING_OP_NOP,
@@ -183,7 +184,8 @@ struct io_uring_params { · 102 unmodified lines
183184 __u32 sq_thread_cpu;
184185 __u32 sq_thread_idle;
185186 __u32 features;
186− __u32 resv[4];
187+ __u32 wq_fd;
188+ __u32 resv[3];
187189 struct io_sqring_offsets sq_off;
188190 struct io_cqring_offsets cq_off;
189191 };