ring/c11: move atomic load of head above the loop
authorGavin Hu <gavin.hu@arm.com>
Fri, 2 Nov 2018 11:21:28 +0000 (19:21 +0800)
committerThomas Monjalon <thomas@monjalon.net>
Mon, 5 Nov 2018 13:34:27 +0000 (14:34 +0100)
commit047adc17245892198be31c54cf6658080df3dc6d
tree46f8b8b66fe903e31b16ae4cb7af79f087fec069
parent9ed877062898dd1eb7150bca56ebbd5329e96ee4
ring/c11: move atomic load of head above the loop

In __rte_ring_move_prod_head, move the __atomic_load_n up and out of
the do {} while loop as upon failure the old_head will be updated,
another load is costly and not necessary.

This helps a little on the latency,about 1~5%.

 Test result with the patch(two cores):
 SP/SC bulk enq/dequeue (size: 8): 5.64
 MP/MC bulk enq/dequeue (size: 8): 9.58
 SP/SC bulk enq/dequeue (size: 32): 1.98
 MP/MC bulk enq/dequeue (size: 32): 2.30

Fixes: 39368ebfc606 ("ring: introduce C11 memory model barrier option")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Steve Capper <steve.capper@arm.com>
Reviewed-by: Ola Liljedahl <ola.liljedahl@arm.com>
Reviewed-by: Jia He <justin.he@arm.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Tested-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
doc/guides/rel_notes/release_18_11.rst
lib/librte_ring/rte_ring_c11_mem.h