[PATCH 16/16] rcu: use previous value atomic fetch operations

Tyler Retzlaff roretzla at linux.microsoft.com
Fri Mar 10 23:15:30 CET 2023


Use __atomic_fetch_{add,and,or,sub,xor} instead of
__atomic_{add,and,or,sub,xor}_fetch adding the necessary code to
allow consumption of the resulting value.

Signed-off-by: Tyler Retzlaff <roretzla at linux.microsoft.com>
---
 lib/rcu/rte_rcu_qsbr.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/rcu/rte_rcu_qsbr.h b/lib/rcu/rte_rcu_qsbr.h
index ccae5d5..1aa078e 100644
--- a/lib/rcu/rte_rcu_qsbr.h
+++ b/lib/rcu/rte_rcu_qsbr.h
@@ -462,7 +462,7 @@ struct rte_rcu_qsbr_dq_parameters {
 	 * structure are visible to the workers before the token
 	 * update is visible.
 	 */
-	t = __atomic_add_fetch(&v->token, 1, __ATOMIC_RELEASE);
+	t = __atomic_fetch_add(&v->token, 1, __ATOMIC_RELEASE) + 1;
 
 	return t;
 }
-- 
1.8.3.1



More information about the dev mailing list