Use __atomic_fetch_{add,and,or,sub,xor} instead of __atomic_{add,and,or,sub,xor}_fetch when we have no interest in the result of the operation.
Reduces unnecessary codegen that provided the result of the atomic operation that was not used. Change brings closer alignment with atomics available in C11 standard and will reduce review effort when they are integrated. Signed-off-by: Tyler Retzlaff <roret...@linux.microsoft.com> Acked-by: Morten Brørup <m...@smartsharesystems.com> Reviewed-by: Maxime Coquelin <maxime.coque...@redhat.com> --- lib/vhost/virtio_net.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c index 51dc3c9..dc49a54 100644 --- a/lib/vhost/virtio_net.c +++ b/lib/vhost/virtio_net.c @@ -298,7 +298,7 @@ vhost_log_cache_sync(dev, vq); - __atomic_add_fetch(&vq->used->idx, vq->shadow_used_idx, + __atomic_fetch_add(&vq->used->idx, vq->shadow_used_idx, __ATOMIC_RELEASE); vq->shadow_used_idx = 0; vhost_log_used_vring(dev, vq, offsetof(struct vring_used, idx), @@ -2311,7 +2311,7 @@ vhost_vring_call_packed(dev, vq); } else { write_back_completed_descs_split(vq, n_descs); - __atomic_add_fetch(&vq->used->idx, n_descs, __ATOMIC_RELEASE); + __atomic_fetch_add(&vq->used->idx, n_descs, __ATOMIC_RELEASE); vhost_vring_call_split(dev, vq); } } else { @@ -3683,7 +3683,7 @@ vhost_vring_call_packed(dev, vq); } else { write_back_completed_descs_split(vq, nr_cpl_pkts); - __atomic_add_fetch(&vq->used->idx, nr_cpl_pkts, __ATOMIC_RELEASE); + __atomic_fetch_add(&vq->used->idx, nr_cpl_pkts, __ATOMIC_RELEASE); vhost_vring_call_split(dev, vq); } vq->async->pkts_inflight_n -= nr_cpl_pkts; -- 1.8.3.1