Manpage updates for iowait toggle feature and one extra FFI fix
cover Manpage updates for iowait toggle feature and one extra FFI fix
Hi Jens,
As previously discussed on Discord, here are two manpage updates about the iowait toggle feature. And then I have one extra FFI trivial fix. The FFI fix is safe to apply for the liburing 2.12 release.
- Add io_uring_set_iowait(3) manpage.
- Add IORING_ENTER_NO_IOWAIT flag to io_uring_enter(2)
- Don't use IOURINGINLINE on private helpers in liburing.h.
---
Ammar Faizi (3):
man: Add io_uring_set_iowait(3)
man: Add IORING_ENTER_NO_IOWAIT flag
liburing: Don't use IOURINGINLINE on private helpers
man/io_uring_enter.2 | 16 ++++++++++- man/io_uring_set_iowait.3 | 57 +++++++++++++++++++++++++++++++++++++++ src/include/liburing.h | 6 ++--- 3 files changed, 75 insertions(+), 4 deletions(-) create mode 100644 man/io_uring_set_iowait.3
base-commit: 6d3d27bc42733f5a407424c76aadcc84bd4b0cf0
Signature · 1 line
Ammar Faizi
PATCH 1/3 man: Add `io_uring_set_iowait(3)`
Based on an explanation from the Linux kernel upstream commit:
07754bfd9aee ("io_uring: enable toggle of iowait usage when waiting on CQEs")
--- man/io_uring_set_iowait.3 | 57 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 man/io_uring_set_iowait.3
man/io_uring_set_iowait.3 new file +57 -0
@@ -0,0 +1,57 @@ +.\" Copyright (C) 2025 Jens Axboe <[email protected]> +.\" Copyright (C) 2025 Ammar Faizi <[email protected]> +.\" +.\" SPDX-License-Identifier: LGPL-2.0-or-later +.\" +.TH io_uring_set_iowait 3 "July 27, 2025" "liburing-2.12" "liburing Manual" +.SH NAME +io_uring_set_iowait \- toggle of iowait usage when waiting on CQEs +.SH SYNOPSIS +.nf +.B #include <liburing.h> +.PP +.BI "int io_uring_set_iowait(struct io_uring *" ring ", +.BI " bool " enable_iowait ");" +.fi +.SH DESCRIPTION +.PP +By default, io_uring marks a waiting task as being in iowait if it's +sleeping waiting on events and there are pending requests. This isn't +necessarily always useful, and may be confusing on non-storage setups +where iowait isn't expected. It can also cause extra power usage by +preventing the CPU from entering lower sleep states. + +The +.BR io_uring_set_iowait (3) +function allows the user to toggle this behavior. If +.BI enable_iowait +is set to true, the iowait behavior is enabled. If it is set to false, +the iowait behavior is disabled. The iowait behavior is enabled by +default when a ring is created. + +If the iowait is disabled, the submit functions will set +.B IORING_ENTER_NO_IOWAIT +in the +.BI flags +argument to +.BR io_uring_enter (2). + +If the kernel supports this feature, it will be marked by having +the +.B IORING_FEAT_NO_IOWAIT +feature flag set. + +Available since kernel 6.15. + + +.SH RETURN VALUE +On success, +.BR io_uring_set_iowait (3) +returns 0. On failure, it returns +.BR -EOPNOTSUPP . + + +.SH SEE ALSO +.BR io_uring_enter (2), +.BR io_uring_submit (3), +.BR io_uring_submit_and_wait (3)
Signature · 1 line
Ammar Faizi
PATCH 2/3 man: Add `IORING_ENTER_NO_IOWAIT` flag
In reply to Ammar FaiziBased on an explanation from the Linux kernel upstream commit:
07754bfd9aee ("io_uring: enable toggle of iowait usage when waiting on CQEs")
--- man/io_uring_enter.2 | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
man/io_uring_enter.2 +15 -1
@@ -134,7 +134,21 @@ but merely an offset into an area of wait regions previously registered with .BR io_uring_register (2) using the .B IORING_REGISTER_MEM_REGION -operation. Available since 6.13 +operation. + +Available since 6.13 + +.TP +.B IORING_ENTER_NO_IOWAIT +When this flag is set, the system call will not mark the waiting task as being +in iowait if it is sleeping waiting on events and there are pending requests. +This is useful if iowait isn't expected when waiting for events. It can also +prevent extra power usage by allowing the CPU to enter lower sleep states. +This flag is only available if the kernel supports the +.B IORING_FEAT_NO_IOWAIT +feature. + +Available since 6.15. .PP .PP
Signature · 1 line
Ammar Faizi
PATCH 3/3 liburing: Don't use `IOURINGINLINE` on private helpers
In reply to Ammar FaiziThese functions:
__io_uring_set_target_fixed_file
__io_uring_peek_cqe
__io_uring_buf_ring_cq_advance
are not exported for FFI. Don't use IOURINGINLINE on them.
--- src/include/liburing.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
src/include/liburing.h +3 -3
@@ -522,7 +522,7 @@ IOURINGINLINE void io_uring_sqe_set_buf_group(struct io_uring_sqe *sqe, sqe->buf_group = (__u16 ) bgid; } -IOURINGINLINE void __io_uring_set_target_fixed_file(struct io_uring_sqe *sqe, +static inline void __io_uring_set_target_fixed_file (struct io_uring_sqe *sqe,unsigned int file_index)LIBURING_NOEXCEPT {
@@ -1742,7 +1742,7 @@ IOURINGINLINE int io_uring_wait_cqe_nr(struct io_uring *ring,* "official" versions of this, io_uring_peek_cqe(), io_uring_wait_cqe(), * or io_uring_wait_cqes*(). */ -IOURINGINLINE int __io_uring_peek_cqe(struct io_uring *ring, +static inline int __io_uring_peek_cqe(struct io_uring *ring, struct io_uring_cqe **cqe_ptr, unsigned *nr_available) LIBURING_NOEXCEPT
@@ -1883,7 +1883,7 @@ IOURINGINLINE void io_uring_buf_ring_advance(struct io_uring_buf_ring *br,io_uring_smp_store_release (&br->tail, new_tail); } -IOURINGINLINE void __io_uring_buf_ring_cq_advance(struct io_uring *ring, +static inline void __io_uring_buf_ring_cq_advance(struct io_uring *ring, struct io_uring_buf_ring *br, int cq_count, int buf_count) LIBURING_NOEXCEPT
Signature · 1 line
Ammar Faizi
Re: [PATCH liburing 3/3] liburing: Don't use `IOURINGINLINE` on private helpers
Quoted 3 lines · Ammar Faizi
__io_uring_set_target_fixed_file
__io_uring_peek_cqe
__io_uring_buf_ring_cq_advance
Oh wait, __io_uring_buf_ring_cq_advance is exported. I assumed that the double-underscore prefix is for internal use only. I will send a v2.
Signature · 1 line
Ammar Faizi