diff --git a/include/asio/detail/impl/io_uring_service.ipp b/include/asio/detail/impl/io_uring_service.ipp index c43b65d7e8..b249195f98 100644 --- a/include/asio/detail/impl/io_uring_service.ipp +++ b/include/asio/detail/impl/io_uring_service.ipp @@ -538,6 +538,14 @@ void io_uring_service::init_ring() asio::detail::throw_error(ec, "io_uring_queue_init"); } +#if defined(ASIO_DISABLE_IO_URING_IOWAIT) +# if !defined(IORING_FEAT_NO_IOWAIT) +# error ASIO_DISABLE_IO_URING_IOWAIT requires liburing 2.12 or later +# endif // !defined(IORING_FEAT_NO_IOWAIT) + // Opt out of io_uring's in_iowait task marking. + (void)::io_uring_set_iowait(&ring_, false); +#endif // defined(ASIO_DISABLE_IO_URING_IOWAIT) + #if !defined(ASIO_HAS_IO_URING_AS_DEFAULT) event_fd_ = ::eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK); if (event_fd_ < 0) diff --git a/src/doc/platform_macros.qbk b/src/doc/platform_macros.qbk index 8e7f171bf1..ae275518ad 100644 --- a/src/doc/platform_macros.qbk +++ b/src/doc/platform_macros.qbk @@ -268,6 +268,13 @@ needs. ] [] ] + [ + [`ASIO_DISABLE_IO_URING_IOWAIT`] + [ + Linux: suppress io_uring's `in_iowait` task marking. + ] + [] + ] [ [`ASIO_HAS_KQUEUE`] [ diff --git a/src/doc/using.qbk b/src/doc/using.qbk index 08897fc55f..73a8651b8d 100644 --- a/src/doc/using.qbk +++ b/src/doc/using.qbk @@ -260,6 +260,13 @@ functionality, and behaviour of Asio. pipe to interrupt blocked epoll/select system calls. ] ] + [ + [`ASIO_DISABLE_IO_URING_IOWAIT`] + [ + Suppresses io_uring's `in_iowait` task marking on Linux via + `io_uring_set_iowait()`. + ] + ] [ [`ASIO_DISABLE_KQUEUE`] [