GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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

@chrisvest chrisvest commented Jun 9, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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

  • 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
  • io-wait used 100% cpu after 6.1.39 and 6.5.1 axboe/liburing#943

Fixes #16655

(cherry picked from commit 3fb6987)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@wineway @chrisvest
IoUring: Pass IORING_ENTER_NO_IOWAIT to report accurate CPU usage (ne…
c4e2d7c
…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)
@chrisvest chrisvest added this to the 5.0.0.Final milestone Jun 9, 2026
@chrisvest
chrisvest enabled auto-merge (squash) June 9, 2026 00:29
@chrisvest chrisvest mentioned this pull request Jun 9, 2026
IoUring: Pass IORING_ENTER_NO_IOWAIT to report accurate CPU usage #16739
Merged
@normanmaurer
normanmaurer disabled auto-merge June 9, 2026 11:58
@normanmaurer
normanmaurer merged commit a98360a into netty:5.0 Jun 9, 2026
11 of 13 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@chrisvest
chrisvest deleted the 5.0-iouring-iowait branch June 9, 2026 16:52
@normanmaurer normanmaurer mentioned this pull request Sep 22, 2026
suspend race fix #17588
Closed
@normanmaurer normanmaurer mentioned this pull request Oct 20, 2026
fix iouring zerocopy iov overwrite #17936
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

5.0.0.Final

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@chrisvest @normanmaurer @wineway
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.