[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [virtio-net] why does the tx virtqueue have a timer?
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [virtio-net] why does the tx virtqueue have a timer? |
Date: |
Tue, 3 Mar 2015 09:36:48 -0600 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Tue, Mar 03, 2015 at 11:21:32AM +0200, Vasile Catalin-B50542 wrote:
> 1. Why does virtio-net have a timer to handle tx virtqueue?
It's a performance optimization. By delaying tx virtqueue processing by
150 microseconds and turning guest->host virtqueue notifications off,
QEMU is able to batch transmit.
> 2. Why isn't the virtqueue kick enough? (I see that both are set to handle
> jobs from virtqueue.)
It is enough. The timer is not for functionality or correctness, it is
purely a performance optimization. The optimization is a gamble, there
are workloads where the extra 150 microseconds of latency causes worse
performance.
> 3. What is the difference between regular timers and bh (bottom halves)? Why
> would you choose one over another?
A bottom half is scheduled in the main loop "as soon as possible". A
timer has a specific duration (150 microseconds by default in this
case).
150 is a magic number. BH is another magic number, essentially. This
is just a bet that performance will be better if we delay a bit to allow
batching.
Hope this helps,
Stefan
pgpflvxadE4t_.pgp
Description: PGP signature