* TO BE INCLUDED ONLY IN LGPL-COMPATIBLE CODE. See urcu-qsbr.h for linking
* dynamically with the userspace rcu QSBR library.
*
- * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
+ * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
* Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
*
* This library is free software; you can redistribute it and/or
}
}
-#if (BITS_PER_LONG < 64)
-static inline int rcu_gp_ongoing(unsigned long *ctr)
-{
- unsigned long v;
-
- v = LOAD_SHARED(*ctr);
- return v && ((v ^ rcu_gp_ctr) & RCU_GP_CTR);
-}
-#else /* !(BITS_PER_LONG < 64) */
static inline int rcu_gp_ongoing(unsigned long *ctr)
{
unsigned long v;
v = LOAD_SHARED(*ctr);
return v && (v != rcu_gp_ctr);
}
-#endif /* !(BITS_PER_LONG < 64) */
static inline void _rcu_read_lock(void)
{
static inline void _rcu_quiescent_state(void)
{
- smp_mb();
+ cmm_smp_mb();
_STORE_SHARED(rcu_reader.ctr, _LOAD_SHARED(rcu_gp_ctr));
- smp_mb(); /* write rcu_reader.ctr before read futex */
+ cmm_smp_mb(); /* write rcu_reader.ctr before read futex */
wake_up_gp();
- smp_mb();
+ cmm_smp_mb();
}
static inline void _rcu_thread_offline(void)
{
- smp_mb();
+ cmm_smp_mb();
STORE_SHARED(rcu_reader.ctr, 0);
- smp_mb(); /* write rcu_reader.ctr before read futex */
+ cmm_smp_mb(); /* write rcu_reader.ctr before read futex */
wake_up_gp();
+ cmm_barrier(); /* Ensure the compiler does not reorder us with mutex */
}
static inline void _rcu_thread_online(void)
{
+ cmm_barrier(); /* Ensure the compiler does not reorder us with mutex */
_STORE_SHARED(rcu_reader.ctr, LOAD_SHARED(rcu_gp_ctr));
- smp_mb();
+ cmm_smp_mb();
}
#ifdef __cplusplus