Update barriers to SEQ_CST in read begin/end
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 26 Oct 2022 19:04:08 +0000 (15:04 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 26 Oct 2022 19:04:08 +0000 (15:04 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
src/rcu.h

index 2831294b546bb4e8edaae0e9ea850146c54a57ff..dca70c6f82cefba212f3d75b7d956e6fb307ae04 100644 (file)
--- a/src/rcu.h
+++ b/src/rcu.h
@@ -42,7 +42,7 @@ unsigned int side_rcu_read_begin(struct side_rcu_gp_state *gp_state)
         * This acquire MO pairs with the release fence at the end of
         * side_rcu_wait_grace_period().
         */
-       (void) __atomic_add_fetch(&gp_state->percpu_state[cpu].count[period].begin, 1, __ATOMIC_ACQUIRE);
+       (void) __atomic_add_fetch(&gp_state->percpu_state[cpu].count[period].begin, 1, __ATOMIC_SEQ_CST);
        return period;
 }
 
@@ -57,7 +57,7 @@ void side_rcu_read_end(struct side_rcu_gp_state *gp_state, unsigned int period)
         * This release MO pairs with the acquire fence at the beginning
         * of side_rcu_wait_grace_period().
         */
-       (void) __atomic_add_fetch(&gp_state->percpu_state[cpu].count[period].end, 1, __ATOMIC_RELEASE);
+       (void) __atomic_add_fetch(&gp_state->percpu_state[cpu].count[period].end, 1, __ATOMIC_SEQ_CST);
 }
 
 #define side_rcu_dereference(p) \
@@ -115,8 +115,8 @@ static inline
 void side_rcu_wait_grace_period(struct side_rcu_gp_state *gp_state)
 {
        /*
-        * This fence pairs with the acquire MO __atomic_add_fetch in
-        * side_rcu_read_begin().
+        * This fence pairs with the __atomic_add_fetch __ATOMIC_SEQ_CST in
+        * side_rcu_read_end().
         */
        __atomic_thread_fence(__ATOMIC_SEQ_CST);
 
@@ -132,8 +132,8 @@ void side_rcu_wait_grace_period(struct side_rcu_gp_state *gp_state)
        pthread_mutex_unlock(&gp_state->gp_lock);
 
        /*
-        * This fence pairs with the release MO __atomic_add_fetch in
-        * side_rcu_read_end().
+        * This fence pairs with the __atomic_add_fetch __ATOMIC_SEQ_CST in
+        * side_rcu_read_begin().
         */
        __atomic_thread_fence(__ATOMIC_SEQ_CST);
 }
This page took 0.024076 seconds and 4 git commands to generate.