perf: optimize virtio-blk queue size and memory barrier#249
Open
cg24-THU wants to merge 1 commit into
Open
Conversation
- Increase default virtio-blk queue size from 16 to 256, matching the Linux virtio_blk default. A larger queue allows more in-flight requests and reduces per-request notification overhead. - Relax the memory barrier in VirtQueue::add() from SeqCst to Release. The fence only needs to order descriptor table and available ring writes before the available index store. A Release fence is sufficient for this producer-ordering requirement, matching Linux's dma_wmb()/virtio_wmb() semantics. On RISC-V this changes the instruction from `fence rw,rw` to `fence rw,w`. Measured on StarryOS (riscv64, QEMU TCG, 10MB sequential I/O): READ 4K: 35.74 → 42.09 MB/s (+17.8%) WRITE 4K: 1.11 → 1.15 MB/s (+3.6%)
Collaborator
|
Are you using |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Two performance improvements for the virtio-blk driver.
Benchmark on StarryOS riscv64 QEMU TCG 10MB sequential IO:
READ 4K: 35.74 to 42.09 MB/s (+17.8%)
WRITE 4K: 1.11 to 1.15 MB/s (+3.6%)
Test plan: cargo check passes, StarryOS smoke test no regression.