]> git.baikalelectronics.ru Git - kernel.git/commit
vhost: fix skb leak in handle_rx()
authorWei Xu <wexu@redhat.com>
Fri, 1 Dec 2017 10:10:36 +0000 (05:10 -0500)
committerDavid S. Miller <davem@davemloft.net>
Sun, 3 Dec 2017 02:31:03 +0000 (21:31 -0500)
commit745ddb68a0f5ff4605e07d75788e5861c8127968
tree6c2a96027995107c57d9039f8d373557bf7fd0bd
parent0398166b30255647086f108a97c91c3c4f387856
vhost: fix skb leak in handle_rx()

Matthew found a roughly 40% tcp throughput regression with commit
6158e372(vhost_net: try batch dequing from skb array) as discussed
in the following thread:
https://www.mail-archive.com/netdev@vger.kernel.org/msg187936.html

Eventually we figured out that it was a skb leak in handle_rx()
when sending packets to the VM. This usually happens when a guest
can not drain out vq as fast as vhost fills in, afterwards it sets
off the traffic jam and leaks skb(s) which occurs as no headcount
to send on the vq from vhost side.

This can be avoided by making sure we have got enough headcount
before actually consuming a skb from the batched rx array while
transmitting, which is simply done by moving checking the zero
headcount a bit ahead.

Signed-off-by: Wei Xu <wexu@redhat.com>
Reported-by: Matthew Rosato <mjrosato@linux.vnet.ibm.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/vhost/net.c