GeezerVison is showing github.com — IoUring: Pass IORING_ENTER_NO_IOWAIT to report accurate CPU usage (#16739) by chrisvest · Pull Request #16924 · netty/netty
Conversation
chrisvest
commented
Jun 9, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Motivation
When a Netty server uses the io_uring transport, the event loop threads that are idly waiting on CQEs are accounted as being in iowait by the kernel. On a server doing no real work, this makes monitoring tools (iostat, top, %iowait metrics) report close to 100% iowait, which:
- Makes it impossible to tell real CPU pressure from an idle io_uring wait on the server.
- Triggers the CPU frequency governor's iowait boost unnecessarily, which wastes power.
This was reported in #16655, where a user with 3 idle connected clients sees:
%user %nice %system %iowait %steal %idle
0.00 0.00 0.51 98.97 0.51 0.00
Modifications
Linux 6.15 added IORING_ENTER_NO_IOWAIT, advertised via the IORING_FEAT_NO_IOWAIT feature bit, which opts out of this accounting (and of the iowait CPU-freq boost) while waiting on CQEs.
- Expose
IORING_ENTER_NO_IOWAIT (1 << 7) and IORING_FEAT_NO_IOWAIT (1 << 17) as constants in Native, following the same hard-coded pattern already used for IORING_ENTER_REGISTERED_RING / IORING_FEAT_RECVSEND_BUNDLE.
- In
IoUring static init, check ringBuffer.features() & IORING_FEAT_NO_IOWAIT (same mechanism used for
IORING_FEAT_RECVSEND_BUNDLE right above) to detect support.
- In
SubmissionQueue.tryRegisterRingFd(), OR IORING_ENTER_NO_IOWAIT into enterFlags when supported, so every io_uring_enter(2) call carries it.
- Report the new capability in
IoUring.featureString() as ENTER_NO_IOWAIT_SUPPORTED=....
On kernels < 6.15 the feature bit is absent, the flag is not set, and behavior is unchanged.
Result
- On kernel ≥ 6.15, io_uring event loop threads waiting on completions are no longer counted as iowait. Server CPU/iowait monitoring now reflects reality.
- No behavior change on older kernels.
Verification
- Built on Linux 7.0.3 (Arch) with OpenJDK 21 via
./mvnw --projects transport-native-io_uring --also-make -DskipTests install — BUILD SUCCESS.
IoUringSocketEchoTest — 7/7 pass.
IoUring.featureString() prints ENTER_NO_IOWAIT_SUPPORTED=true on the 7.x test kernel, confirming the feature bit is detected.
References
Fixes #16655
(cherry picked from commit 3fb6987)
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…tty#16739)
### Motivation
When a Netty server uses the io_uring transport, the event loop threads
that are idly waiting on CQEs are accounted as being in `iowait` by the
kernel. On a server doing no real work, this makes monitoring tools
(`iostat`, `top`, `%iowait` metrics) report close to 100% iowait, which:
- Makes it impossible to tell real CPU pressure from an idle io_uring
wait on the server.
- Triggers the CPU frequency governor's iowait boost unnecessarily,
which wastes power.
This was reported in netty#16655, where a user with 3 idle connected clients
sees:
```
%user %nice %system %iowait %steal %idle
0.00 0.00 0.51 98.97 0.51 0.00
```
### Modifications
Linux 6.15 added `IORING_ENTER_NO_IOWAIT`, advertised via the
`IORING_FEAT_NO_IOWAIT` feature bit, which opts out of this accounting
(and of the iowait CPU-freq boost) while waiting on CQEs.
- Expose `IORING_ENTER_NO_IOWAIT` (`1 << 7`) and `IORING_FEAT_NO_IOWAIT`
(`1 << 17`) as constants in `Native`, following the same hard-coded
pattern already used for `IORING_ENTER_REGISTERED_RING` /
`IORING_FEAT_RECVSEND_BUNDLE`.
- In `IoUring` static init, check `ringBuffer.features() &
IORING_FEAT_NO_IOWAIT` (same mechanism used for
`IORING_FEAT_RECVSEND_BUNDLE` right above) to detect support.
- In `SubmissionQueue.tryRegisterRingFd()`, OR `IORING_ENTER_NO_IOWAIT`
into `enterFlags` when supported, so every `io_uring_enter(2)` call
carries it.
- Report the new capability in `IoUring.featureString()` as
`ENTER_NO_IOWAIT_SUPPORTED=...`.
On kernels < 6.15 the feature bit is absent, the flag is not set, and
behavior is unchanged.
### Result
- On kernel ≥ 6.15, io_uring event loop threads waiting on completions
are no longer counted as iowait. Server CPU/iowait monitoring now
reflects reality.
- No behavior change on older kernels.
### Verification
- Built on Linux 7.0.3 (Arch) with OpenJDK 21 via `./mvnw --projects
transport-native-io_uring --also-make -DskipTests install` — BUILD
SUCCESS.
- `IoUringSocketEchoTest` — 7/7 pass.
- `IoUring.featureString()` prints `ENTER_NO_IOWAIT_SUPPORTED=true` on
the 7.x test kernel, confirming the feature bit is detected.
### References
- Kernel commit:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=07754bfd9aee59063f8549f6e4d455eae636ecc7
- `io_uring_enter(2)`:
https://man7.org/linux/man-pages/man2/io_uring_enter.2.html
- axboe/liburing#943
Fixes netty#16655
(cherry picked from commit 3fb6987)
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|