From: Gavin Hu Date: Fri, 2 Nov 2018 11:21:28 +0000 (+0800) Subject: ring/c11: move atomic load of head above the loop X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=047adc17245892198be31c54cf6658080df3dc6d;hp=047adc17245892198be31c54cf6658080df3dc6d;p=dpdk.git 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 Reviewed-by: Honnappa Nagarahalli Reviewed-by: Steve Capper Reviewed-by: Ola Liljedahl Reviewed-by: Jia He Acked-by: Jerin Jacob Tested-by: Jerin Jacob Acked-by: Olivier Matz ---