]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - include/linux/rcupdate.h
Merge tag 'gfs2-v5.3-rc3.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux.git] / include / linux / rcupdate.h
index b25d20822e75481de81b8e044d665fcb74d92d07..8f7167478c1d0b96ae4ed56ec67a11ba08c6f90d 100644 (file)
@@ -365,16 +365,15 @@ static inline void rcu_preempt_sleep_check(void) { }
  * other macros that it invokes.
  */
 #define rcu_assign_pointer(p, v)                                             \
-({                                                                           \
+do {                                                                         \
        uintptr_t _r_a_p__v = (uintptr_t)(v);                                 \
-       rcu_check_sparse(p, __rcu);                                   \
+       rcu_check_sparse(p, __rcu);                                           \
                                                                              \
        if (__builtin_constant_p(v) && (_r_a_p__v) == (uintptr_t)NULL)        \
                WRITE_ONCE((p), (typeof(p))(_r_a_p__v));                      \
        else                                                                  \
                smp_store_release(&p, RCU_INITIALIZER((typeof(p))_r_a_p__v)); \
-       _r_a_p__v;                                                            \
-})
+} while (0)
 
 /**
  * rcu_swap_protected() - swap an RCU and a regular pointer
@@ -586,7 +585,7 @@ static inline void rcu_preempt_sleep_check(void) { }
  * read-side critical sections may be preempted and they may also block, but
  * only when acquiring spinlocks that are subject to priority inheritance.
  */
-static inline void rcu_read_lock(void)
+static __always_inline void rcu_read_lock(void)
 {
        __rcu_read_lock();
        __acquire(RCU);
@@ -803,7 +802,7 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
 /**
  * kfree_rcu() - kfree an object after a grace period.
  * @ptr:       pointer to kfree
- * @rcu_head:  the name of the struct rcu_head within the type of @ptr.
+ * @rhf:       the name of the struct rcu_head within the type of @ptr.
  *
  * Many rcu callbacks functions just call kfree() on the base structure.
  * These functions are trivial, but their size adds up, and furthermore
@@ -826,9 +825,13 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
  * The BUILD_BUG_ON check must not involve any function calls, hence the
  * checks are done in macros here.
  */
-#define kfree_rcu(ptr, rcu_head)                                       \
-       __kfree_rcu(&((ptr)->rcu_head), offsetof(typeof(*(ptr)), rcu_head))
-
+#define kfree_rcu(ptr, rhf)                                            \
+do {                                                                   \
+       typeof (ptr) ___p = (ptr);                                      \
+                                                                       \
+       if (___p)                                                       \
+               __kfree_rcu(&((___p)->rhf), offsetof(typeof(*(ptr)), rhf)); \
+} while (0)
 
 /*
  * Place this after a lock-acquisition primitive to guarantee that