rcu: Upgrade rcu_swap_protected() to rcu_replace_pointer()
authorPaul E. McKenney <paulmck@kernel.org>
Mon, 23 Sep 2019 22:05:11 +0000 (15:05 -0700)
committerPaul E. McKenney <paulmck@kernel.org>
Wed, 30 Oct 2019 15:43:08 +0000 (08:43 -0700)
commita63fc6b75cca984c71f095282e0227a390ba88f3
tree3ef7fa0aeeba009a3994f424bb9ba5f7de65045f
parent54ecb8f7028c5eb3d740bb82b0f1d90f2df63c5c
rcu: Upgrade rcu_swap_protected() to rcu_replace_pointer()

Although the rcu_swap_protected() macro follows the example of
swap(), the interactions with RCU make its update of its argument
somewhat counter-intuitive.  This commit therefore introduces
an rcu_replace_pointer() that returns the old value of the RCU
pointer instead of doing the argument update.  Once all the uses of
rcu_swap_protected() are updated to instead use rcu_replace_pointer(),
rcu_swap_protected() will be removed.

Link: https://lore.kernel.org/lkml/CAHk-=wiAsJLw1egFEE=Z7-GGtM6wcvtyytXZA1+BHqta4gg6Hw@mail.gmail.com/
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
[ paulmck: From rcu_replace() to rcu_replace_pointer() per Ingo Molnar. ]
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Cc: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Cc: Shane M Seymour <shane.seymour@hpe.com>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
include/linux/rcupdate.h