io_uring: enable toggle of iowait usage when waiting on CQEs
authorJens Axboe <axboe@kernel.dk>
Fri, 14 Mar 2025 16:19:01 +0000 (10:19 -0600)
committerJens Axboe <axboe@kernel.dk>
Fri, 21 Mar 2025 02:01:03 +0000 (20:01 -0600)
commit07754bfd9aee59063f8549f6e4d455eae636ecc7
tree704d0ae855958c9209c92c5c816843da8083613a
parent96af5af47b5407972689929543c73a39b477c8ba
io_uring: enable toggle of iowait usage when waiting on CQEs

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.

This adds a new enter flag, IORING_ENTER_NO_IOWAIT. If set, then
io_uring will not account the sleeping task as being in iowait. If the
kernel supports this feature, then it will be marked by having the
IORING_FEAT_NO_IOWAIT feature flag set.

As the kernel currently does not support separating the iowait
accounting and CPU frequency boosting, the IORING_ENTER_NO_IOWAIT
controls both of these at the same time. In the future, if those do end
up being split, then it'd be possible to control them separately.
However, it seems more likely that the kernel will decouple iowait and
CPU frequency boosting anyway.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
include/uapi/linux/io_uring.h
io_uring/io_uring.c