Ensure that mutex acquisition/release is not reordered wrt rcu read lock/unlock.
No impact in practice because pthreads lock/unlock primitives act as memory
barriers. But we should provide the same guarantees we are expecting from other
locking primitives, hence this modification.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
if (unlikely(!rcu_reader))
rcu_bp_register();
+ barrier(); /* Ensure the compiler does not reorder us with mutex */
tmp = rcu_reader->ctr;
/*
* rcu_gp_ctr is
*/
smp_mb();
_STORE_SHARED(rcu_reader->ctr, rcu_reader->ctr - RCU_GP_COUNT);
+ barrier(); /* Ensure the compiler does not reorder us with mutex */
}
#ifdef __cplusplus
STORE_SHARED(rcu_reader.ctr, 0);
smp_mb(); /* write rcu_reader.ctr before read futex */
wake_up_gp();
+ barrier(); /* Ensure the compiler does not reorder us with mutex */
}
static inline void _rcu_thread_online(void)
{
+ barrier(); /* Ensure the compiler does not reorder us with mutex */
_STORE_SHARED(rcu_reader.ctr, LOAD_SHARED(rcu_gp_ctr));
smp_mb();
}
{
unsigned long tmp;
+ barrier(); /* Ensure the compiler does not reorder us with mutex */
tmp = rcu_reader.ctr;
/*
* rcu_gp_ctr is
} else {
_STORE_SHARED(rcu_reader.ctr, rcu_reader.ctr - RCU_GP_COUNT);
}
+ barrier(); /* Ensure the compiler does not reorder us with mutex */
}
#ifdef __cplusplus