virtio_ring: assume sgs are always well-formed.
authorRusty Russell <rusty@rustcorp.com.au>
Thu, 11 Sep 2014 00:47:37 +0000 (10:17 +0930)
committerDavid S. Miller <davem@davemloft.net>
Sat, 13 Sep 2014 16:50:46 +0000 (12:50 -0400)
commiteeebf9b1fc0862466c5661d63fbaf66ab4a50210
treea0b217e5f0c70869c73b270ee8faa75c250a2b2f
parenta58354409a00f2d8f7882c6a91fde1df5d0a4bb8
virtio_ring: assume sgs are always well-formed.

We used to have several callers which just used arrays.  They're
gone, so we can use sg_next() everywhere, simplifying the code.

On my laptop, this slowed down vring_bench by 15%:

vring_bench before:
936153354-967745359(9.44739e+08+/-6.1e+06)ns
vring_bench after:
1061485790-1104800648(1.08254e+09+/-6.6e+06)ns

However, a more realistic test using pktgen on a AMD FX(tm)-8320 saw
a few percent improvement:

pktgen before:
  767390-792966(785159+/-6.5e+03)pps 356-367(363.75+/-2.9)Mb/sec (356068960-367936224(3.64314e+08+/-3e+06)bps) errors: 0

pktgen after:
   787781-796334(793165+/-2.4e+03)pps 365-369(367.5+/-1.2)Mb/sec (365530384-369498976(3.68028e+08+/-1.1e+06)bps) errors: 0

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/virtio/virtio_ring.c