Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vhost: Avoid TX queue when writing directly is faster
Using vhost makes high-volume transfers go nice and fast, especially we are using 100% of a CPU in the single-threaded OpenConnect process and just offloading the kernel←→user copies for the tun packets to the vhost thread instead of having to do them from our single thread too. However, for a lightly used link with *occasional* packets, which is fairly much the definition of a VPN being used for VoIP, it adds a lot of unwanted latency. If our userspace thread is otherwise going to be *idle*, and fall back into select() to wait for something else to do, then we might as well just write the packet *directly* to the tun device. So... when the queue is stopped and would need to be kicked, and if there are only a *few* (heuristic: half max_qlen) packets on the queue to be sent, just send them directly. Signed-off-by: David Woodhouse <[email protected]>
- Loading branch information