-static inline int rcu_old_gp_ongoing(long *value)
-{
- long v;
-
- if (value == NULL)
- return 0;
- /*
- * Make sure both tests below are done on the same version of *value
- * to insure consistency.
- */
- v = ACCESS_ONCE(*value);
- return (v & RCU_GP_CTR_NEST_MASK) &&
- ((v ^ urcu_gp_ctr) & RCU_GP_CTR_BIT);
-}
-
-static inline void rcu_read_lock(void)
-{
- long tmp;
-
- tmp = urcu_active_readers;
- /* urcu_gp_ctr = RCU_GP_COUNT | (~RCU_GP_CTR_BIT or RCU_GP_CTR_BIT) */
- /* The data dependency "read urcu_gp_ctr, write urcu_active_readers",
- * serializes those two memory operations. */
- if (likely(!(tmp & RCU_GP_CTR_NEST_MASK)))
- urcu_active_readers = ACCESS_ONCE(urcu_gp_ctr);
- else
- urcu_active_readers = tmp + RCU_GP_COUNT;
- /*
- * Increment active readers count before accessing the pointer.
- * See force_mb_all_threads().
- */
- read_barrier();
-}
-
-static inline void rcu_read_unlock(void)
-{
- read_barrier();
- /*
- * Finish using rcu before decrementing the pointer.
- * See force_mb_all_threads().
- */
- urcu_active_readers -= RCU_GP_COUNT;
-}
-
-/**
- * rcu_assign_pointer - assign (publicize) a pointer to a newly
- * initialized structure that will be dereferenced by RCU read-side
- * critical sections. Returns the value assigned.
- *
- * Inserts memory barriers on architectures that require them
- * (pretty much all of them other than x86), and also prevents
- * the compiler from reordering the code that initializes the
- * structure after the pointer assignment. More importantly, this
- * call documents which pointers will be dereferenced by RCU read-side
- * code.