Thanks to visit codestin.com
Credit goes to github.com

Skip to content

block: Batch drain AIO completions in next_completed_request - #7864

Merged
rbradford merged 1 commit into
cloud-hypervisor:mainfrom
weltling:block-aio-batch-drain
Mar 19, 2026
Merged

rbradford merged 1 commit into
cloud-hypervisor:mainfrom
weltling:block-aio-batch-drain

Conversation

@weltling

Copy link
Copy Markdown
Member

Collect up to 32 completions per io_getevents call instead of one at a time, buffering them in the existing VecDeque. At the default queue depth of 128, this reduces syscalls from 128 to 4 per drain cycle.

The batch size of 32 matches QEMU DEFAULT_MAX_BATCH. The stack cost is 1 KB per call (32 x 32 byte IoEvent).

Micro benchmark results

Test Before After (batch=32) Speedup
drain_128 61.8 us 8.2 us ~8x
drain_256 160.1 us 12.6 us ~13x

Collect up to 32 completions per io_getevents call instead of one
at a time, buffering them in the existing VecDeque. This reduces
syscalls from 128 to 4 per drain cycle at the default queue depth.
The stack cost is 1 KB per call.

Signed-off-by: Anatol Belski <[email protected]>
@weltling
weltling requested a review from a team as a code owner March 19, 2026 11:13

@phip1611 phip1611 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find and thanks for the microbenchmark!

@rbradford
rbradford enabled auto-merge March 19, 2026 12:02
@rbradford
rbradford added this pull request to the merge queue Mar 19, 2026
Merged via the queue into cloud-hypervisor:main with commit 19fa512 Mar 19, 2026
37 checks passed
@weltling
weltling deleted the block-aio-batch-drain branch March 19, 2026 13:52
@rbradford rbradford moved this to ✅ Done in Cloud Hypervisor Roadmap Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

3 participants