rcu: Add ACCESS_ONCE() for RCU_INIT_POINTER() It is permissible to use RCU_INIT_POINTER() instead of rcu_assign_pointer() in a couple of cases where readers might be concurrently accessing the pointer being assigned to: (1) When assigning NULL and (2) When assigning a pointer that is already visible to readers. In these two cases, we should really be using ACCESS_ONCE() to prevent compiler mischief. This commit therefore adds the ACCESS_ONCE(). Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index 334ff89..315772c 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h
@@ -997,7 +997,7 @@ */ #define RCU_INIT_POINTER(p, v) \ do { \ - p = RCU_INITIALIZER(v); \ + ACCESS_ONCE(p) = (v); \ } while (0) /**