History

io_uring: wire up min batch wake timeout

Expose min_wait_usec in io_uring_getevents_arg, replacing the pad member that is currently in there. The value is in usecs, which is explained in the name as well. Note that if min_wait_usec and a normal timeout is used in conjunction, the normal timeout is still relative to the base time. For example, if min_wait_usec is set to 100 and the normal timeout is 1000, the max total time waited is still 1000. This also means that if the normal timeout is shorter than min_wait_usec, then only the min_wait_usec will take effect. See previous commit for an explanation of how this works. IORING_FEAT_MIN_TIMEOUT is added as a feature flag for this, as applications doing submit_and_wait_timeout() style operations will generally not see the -EINVAL from the wait side as they return the number of IOs submitted. Only if no IOs are submitted will the -EINVAL bubble back up to the application.

Jens Axboe committed 2 years ago

Commit 7ed9e091 parent 1100c4a2 files · +6 −5Browse files

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

Unified · Split

include/uapi/linux/io_uring.h+2−1
@@ -543,6 +543,7 @@ struct io_uring_params { · 542 unmodified lines
543543 #define IORING_FEAT_LINKED_FILE (1U << 12)
544544 #define IORING_FEAT_REG_REG_RING (1U << 13)
545545 #define IORING_FEAT_RECVSEND_BUNDLE (1U << 14)
546+#define IORING_FEAT_MIN_TIMEOUT (1U << 15)
546547
547548 /*
548549 * io_uring_register(2) opcodes and arguments
@@ -766,7 +767,7 @@ enum io_uring_register_restriction_op { · 217 unmodified lines
766767 struct io_uring_getevents_arg {
767768 __u64 sigmask;
768769 __u32 sigmask_sz;
769− __u32 pad;
770+ __u32 min_wait_usec;
770771 __u64 ts;
771772 };
772773