OSDN Git Service

virtio: use shadow_avail_idx while checking number of heads
authorIlya Maximets <i.maximets@ovn.org>
Wed, 27 Sep 2023 13:50:33 +0000 (15:50 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Wed, 4 Oct 2023 22:15:06 +0000 (18:15 -0400)
commit850cd20b072cd330cb24aa1c92732b9722998d40
tree1d605e3c657b1eee2cba4bb66e1fbffe23eb88b0
parenta6f4d2ec42f3feb6c399f5760a2567ca78897bd7
virtio: use shadow_avail_idx while checking number of heads

We do not need the most up to date number of heads, we only want to
know if there is at least one.

Use shadow variable as long as it is not equal to the last available
index checked.  This avoids expensive qatomic dereference of the
RCU-protected memory region cache as well as the memory access itself.

The change improves performance of the af-xdp network backend by 2-3%.

Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Message-Id: <20230927135157.2316982-1-i.maximets@ovn.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/virtio/virtio.c