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.
Showing the changes to include/uapi/linux (1 of 2 files). Show all
Unified · Split
| @@ -75,6 +75,7 @@ enum { · 74 unmodified lines | ||
| 75 | 75 | #define IORING_SETUP_SQ_AFF (1U << 2) /* sq_thread_cpu is valid */ |
| 76 | 76 | #define IORING_SETUP_CQSIZE (1U << 3) /* app defines CQ size */ |
| 77 | 77 | #define IORING_SETUP_CLAMP (1U << 4) /* clamp SQ/CQ ring sizes */ |
| 78 | +#define IORING_SETUP_ATTACH_WQ (1U << 5) /* attach to existing wq */ | |
| 78 | 79 | |
| 79 | 80 | enum { |
| 80 | 81 | IORING_OP_NOP, |
| @@ -183,7 +184,8 @@ struct io_uring_params { · 102 unmodified lines | ||
| 183 | 184 | __u32 sq_thread_cpu; |
| 184 | 185 | __u32 sq_thread_idle; |
| 185 | 186 | __u32 features; |
| 186 | − __u32 resv[4]; | |
| 187 | + __u32 wq_fd; | |
| 188 | + __u32 resv[3]; | |
| 187 | 189 | struct io_sqring_offsets sq_off; |
| 188 | 190 | struct io_cqring_offsets cq_off; |
| 189 | 191 | }; |