Skip to content

Commit

Permalink
doc: Update RCU requirements RCU_INIT_POINTER() description
Browse files Browse the repository at this point in the history
Back in the day, RCU_INIT_POINTER() was the only way to avoid
memory-barrier instructions while storing NULL to an RCU-protected
pointer.  Fortunately, in 2016, rcu_assign_pointer() started checking for
compile-time NULL pointers and omitting the memory-barrier instructions in
that case.  Unfortunately, RCU's Requirements.rst document was not updated
accordingly.  This commit therefore at long last carries out that update.

Fixes: 3a37f72 ("rcu: No ordering for rcu_assign_pointer() of NULL")
Link: https://lore.kernel.org/lkml/20201209230755.GV7338@casper.infradead.org/
Reported-by: Matthew Wilcox <willy@infradead.org>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
  • Loading branch information
Paul E. McKenney committed Jan 4, 2021
1 parent 9d3a048 commit d756c74
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions Documentation/RCU/Design/Requirements/Requirements.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1668,8 +1668,7 @@ against mishaps and misuse:
this purpose.
#. It is not necessary to use rcu_assign_pointer() when creating
linked structures that are to be published via a single external
pointer. The RCU_INIT_POINTER() macro is provided for this task
and also for assigning ``NULL`` pointers at runtime.
pointer. The RCU_INIT_POINTER() macro is provided for this task.

This not a hard-and-fast list: RCU's diagnostic capabilities will
continue to be guided by the number and type of usage bugs found in
Expand Down

0 comments on commit d756c74

Please sign in to comment.