[2/5] lib/stack: remove push acquire fence

Message ID 20200911152938.8019-3-steven.lariau@arm.com (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Headers
Series lib/stack: improve lockfree C11 implementation |

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Steven Lariau Sept. 11, 2020, 3:29 p.m. UTC
  An acquire fence is used to make sure loads after the fence can observe
all store operations before a specific store-release.
But push doesn't read any data, except for the head which is part of a
CAS operation (the items on the list are not read).
So there is no need for the acquire barrier.

Signed-off-by: Steven Lariau <steven.lariau@arm.com>
Reviewed-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 lib/librte_stack/rte_stack_lf_c11.h | 6 ------
 1 file changed, 6 deletions(-)
  

Comments

Eads, Gage Sept. 21, 2020, 5:16 p.m. UTC | #1
> -----Original Message-----
> From: Steven Lariau <steven.lariau@arm.com>
> Sent: Friday, September 11, 2020 10:30 AM
> To: Eads, Gage <gage.eads@intel.com>; Olivier Matz <olivier.matz@6wind.com>
> Cc: dev@dpdk.org; nd@arm.com; dharmik.thakkar@arm.com; Steven Lariau
> <steven.lariau@arm.com>
> Subject: [PATCH 2/5] lib/stack: remove push acquire fence
> 
> An acquire fence is used to make sure loads after the fence can observe
> all store operations before a specific store-release.
> But push doesn't read any data, except for the head which is part of a
> CAS operation (the items on the list are not read).
> So there is no need for the acquire barrier.
> 
> Signed-off-by: Steven Lariau <steven.lariau@arm.com>
> Reviewed-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>

Acked-by: Gage Eads <gage.eads@intel.com>

Thanks,
Gage
  

Patch

diff --git a/lib/librte_stack/rte_stack_lf_c11.h b/lib/librte_stack/rte_stack_lf_c11.h
index 1e0ea0bef..82b7287f1 100644
--- a/lib/librte_stack/rte_stack_lf_c11.h
+++ b/lib/librte_stack/rte_stack_lf_c11.h
@@ -44,12 +44,6 @@  __rte_stack_lf_push_elems(struct rte_stack_lf_list *list,
 	do {
 		struct rte_stack_lf_head new_head;
 
-		/* Use an acquire fence to establish a synchronized-with
-		 * relationship between the list->head load and store-release
-		 * operations (as part of the rte_atomic128_cmp_exchange()).
-		 */
-		__atomic_thread_fence(__ATOMIC_ACQUIRE);
-
 		/* Swing the top pointer to the first element in the list and
 		 * make the last element point to the old top.
 		 */