virtio-devices: block: Reduce latency in completion handling

Signal the guest before processing queue submissions to enable
earlier guest side completion event handling, reducing end-to-end
latency for block device operations.

FIO benchmarks show up to 7.4% bandwidth improvement at 16
iodepth and 4k block size with NVMe devices.

Signed-off-by: wuxinyue <wuxinyue.wxy@antgroup.com>
This commit is contained in:
wuxinyue
2025-12-02 11:45:32 +08:00
committed by Rob Bradford
parent 40768086b9
commit 19d0196291

View File

@@ -607,17 +607,14 @@ impl EpollHelperHandler for BlockEpollHandler {
))
})?;
self.try_signal_used_queue()?;
let rate_limit_reached = self.rate_limiter.as_ref().is_some_and(|r| r.is_blocked());
// Process the queue only when the rate limit is not reached
if !rate_limit_reached {
self.process_queue_submit().map_err(|e| {
EpollHelperError::HandleEvent(anyhow!(
"Failed to process queue (submit): {e:?}"
))
})?;
self.process_queue_submit_and_signal()?;
}
self.try_signal_used_queue()?;
}
RATE_LIMITER_EVENT => {
if let Some(rate_limiter) = &mut self.rate_limiter {