virtio_net: Make delayed refill more reliable
authorHerbert Xu <herbert@gondor.apana.org.au>
Mon, 25 Jan 2010 23:51:01 +0000 (15:51 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 5 Jul 2010 18:10:41 +0000 (11:10 -0700)
commitbe4aa3f7edac32e5bc445bb108e79a7f5c3d7b1f
tree0a97d94d05e5899a70dae791eb84382b5dfd7d08
parent061d0096906dc7ed6a7d87fc0c9bc07794b7d3f2
virtio_net: Make delayed refill more reliable

commit 39d321577405e8e269fd238b278aaf2425fa788a upstream.

I have seen RX stalls on a machine that experienced a suspected
OOM.  After the stall, the RX buffer is empty on the guest side
and there are exactly 16 entries available on the host side.  As
the number of entries is less than that required by a maximal
skb, the host cannot proceed.

The guest did not have a refill job scheduled.

My diagnosis is that an OOM had occured, with the delayed refill
job scheduled.  The job was able to allocate at least one skb, but
not enough to overcome the minimum required by the host to proceed.

As the refill job would only reschedule itself if it failed completely
to allocate any skbs, this would lead to an RX stall.

The following patch removes this stall possibility by always
rescheduling the refill job until the ring is totally refilled.

Testing has shown that the RX stall no longer occurs whereas
previously it would occur within a day.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Acked-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: Bruce Rogers <brogers@novell.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/net/virtio_net.c