diff options
-rw-r--r-- | include/linux/rcupdate.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index c61b6b9506e7..a8af79738a0e 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
@@ -650,7 +650,16 @@ static inline void rcu_preempt_sleep_check(void) | |||
650 | * please be careful when making changes to rcu_assign_pointer() and the | 650 | * please be careful when making changes to rcu_assign_pointer() and the |
651 | * other macros that it invokes. | 651 | * other macros that it invokes. |
652 | */ | 652 | */ |
653 | #define rcu_assign_pointer(p, v) smp_store_release(&p, RCU_INITIALIZER(v)) | 653 | #define rcu_assign_pointer(p, v) \ |
654 | ({ \ | ||
655 | uintptr_t _r_a_p__v = (uintptr_t)(v); \ | ||
656 | \ | ||
657 | if (__builtin_constant_p(v) && (_r_a_p__v) == (uintptr_t)NULL) \ | ||
658 | WRITE_ONCE((p), (typeof(p))(_r_a_p__v)); \ | ||
659 | else \ | ||
660 | smp_store_release(&p, RCU_INITIALIZER((typeof(p))_r_a_p__v)); \ | ||
661 | _r_a_p__v; \ | ||
662 | }) | ||
654 | 663 | ||
655 | /** | 664 | /** |
656 | * rcu_access_pointer() - fetch RCU pointer with no dereferencing | 665 | * rcu_access_pointer() - fetch RCU pointer with no dereferencing |