[RFC] ring: remove unnecessary fences in C11 ring for performance

Wathsala Vithanage wathsala.vithanage at arm.com
Mon Jun 12 21:47:16 CEST 2023


For improved performance over the current C11 based ring
implementation, two ACQUIRE fences between the load of the old_head
and the load of the const_tail in __rte_ring_move_prod_head and the
load of old_head and load of the prod_tail in
__rte_ring_move_cons_head functions have been removed. These two
fences are not required for the safety of the ring library.

Signed-off-by: Wathsala Vithanage <wathsala.vithanage at arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli at arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang at arm.com>
---
 .mailmap                    | 1 +
 lib/ring/rte_ring_c11_pvt.h | 6 ------
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/.mailmap b/.mailmap
index 4018f0fc47..367115d134 100644
--- a/.mailmap
+++ b/.mailmap
@@ -1430,6 +1430,7 @@ Walter Heymans <walter.heymans at corigine.com>
 Wang Sheng-Hui <shhuiw at gmail.com>
 Wangyu (Eric) <seven.wangyu at huawei.com>
 Waterman Cao <waterman.cao at intel.com>
+Wathsala Vithanage <wathsala.vithanage at arm.com>
 Weichun Chen <weichunx.chen at intel.com>
 Wei Dai <wei.dai at intel.com>
 Weifeng Li <liweifeng96 at 126.com>
diff --git a/lib/ring/rte_ring_c11_pvt.h b/lib/ring/rte_ring_c11_pvt.h
index f895950df4..eb59c61b6a 100644
--- a/lib/ring/rte_ring_c11_pvt.h
+++ b/lib/ring/rte_ring_c11_pvt.h
@@ -66,9 +66,6 @@ __rte_ring_move_prod_head(struct rte_ring *r, unsigned int is_sp,
 		/* Reset n to the initial burst count */
 		n = max;
 
-		/* Ensure the head is read before tail */
-		__atomic_thread_fence(__ATOMIC_ACQUIRE);
-
 		/* load-acquire synchronize with store-release of ht->tail
 		 * in update_tail.
 		 */
@@ -142,9 +139,6 @@ __rte_ring_move_cons_head(struct rte_ring *r, int is_sc,
 		/* Restore n as it may change every loop */
 		n = max;
 
-		/* Ensure the head is read before tail */
-		__atomic_thread_fence(__ATOMIC_ACQUIRE);
-
 		/* this load-acquire synchronize with store-release of ht->tail
 		 * in update_tail.
 		 */
-- 
2.25.1



More information about the dev mailing list