[Linux-kernel-mentees] [PATCH] Documentation: RCU: whatisRCU: Fix formatting for section 2
Paul E. McKenney
paulmck at kernel.org
Mon Nov 4 15:03:28 UTC 2019
On Mon, Nov 04, 2019 at 07:03:15PM +0530, Amol Grover wrote:
> Convert RCU API method text to sub-headings and
> add hyperlink and superscript to 2 literary notes
> under rcu_dereference() section
> Signed-off-by: Amol Grover <frextrite at gmail.com>
Good stuff, but Phong Tran beat you to it. If you are suggesting
changes to that patch, please send a reply to her email, which
may be found here:
There are several options for replying to this email listed at the
bottom of that web page.
> Documentation/RCU/whatisRCU.rst | 34 +++++++++++++++++++++++++++------
> 1 file changed, 28 insertions(+), 6 deletions(-)
> diff --git a/Documentation/RCU/whatisRCU.rst b/Documentation/RCU/whatisRCU.rst
> index ae40c8bcc56c..3cf6e17d0065 100644
> --- a/Documentation/RCU/whatisRCU.rst
> +++ b/Documentation/RCU/whatisRCU.rst
> @@ -150,6 +150,7 @@ later. See the kernel docbook documentation for more info, or look directly
> at the function header comments.
> void rcu_read_lock(void);
> @@ -164,6 +165,7 @@ rcu_read_lock()
> longer-term references to data structures.
> void rcu_read_unlock(void);
> @@ -172,6 +174,7 @@ rcu_read_unlock()
> read-side critical sections may be nested and/or overlapping.
> void synchronize_rcu(void);
> @@ -225,6 +228,7 @@ synchronize_rcu()
> checklist.txt for some approaches to limiting the update rate.
> void rcu_assign_pointer(p, typeof(p) v);
> @@ -245,6 +249,7 @@ rcu_assign_pointer()
> the _rcu list-manipulation primitives such as list_add_rcu().
> typeof(p) rcu_dereference(p);
> @@ -279,8 +284,10 @@ rcu_dereference()
> if an update happened while in the critical section, and incur
> unnecessary overhead on Alpha CPUs.
> +.. _back_to_1:
> Note that the value returned by rcu_dereference() is valid
> - only within the enclosing RCU read-side critical section .
> + only within the enclosing RCU read-side critical section |cs_1|.
> For example, the following is -not- legal::
> @@ -298,15 +305,27 @@ rcu_dereference()
> it was acquired is just as illegal as doing so with normal
> +.. _back_to_2:
> As with rcu_assign_pointer(), an important function of
> rcu_dereference() is to document which pointers are protected by
> RCU, in particular, flagging a pointer that is subject to changing
> at any time, including immediately after the rcu_dereference().
> And, again like rcu_assign_pointer(), rcu_dereference() is
> typically used indirectly, via the _rcu list-manipulation
> - primitives, such as list_for_each_entry_rcu() .
> + primitives, such as list_for_each_entry_rcu() |entry_2|.
> +.. |cs_1| raw:: html
> + <a href="#cs"><sup></sup></a>
> +.. |entry_2| raw:: html
> -  The variant rcu_dereference_protected() can be used outside
> + <a href="#entry"><sup></sup></a>
> +.. _cs:
> + \ :sup:``\ The variant rcu_dereference_protected() can be used outside
> of an RCU read-side critical section as long as the usage is
> protected by locks acquired by the update-side code. This variant
> avoids the lockdep warning that would happen when using (for
> @@ -317,15 +336,18 @@ rcu_dereference()
> a lockdep expression to indicate which locks must be acquired
> by the caller. If the indicated protection is not provided,
> a lockdep splat is emitted. See Documentation/RCU/Design/Requirements/Requirements.rst
> - and the API's code comments for more details and example usage.
> + and the API's code comments for more details and example usage. :ref:`back <back_to_1>`
> +.. _entry:
> -  If the list_for_each_entry_rcu() instance might be used by
> + \ :sup:``\ If the list_for_each_entry_rcu() instance might be used by
> update-side code as well as by RCU readers, then an additional
> lockdep expression can be added to its list of arguments.
> For example, given an additional "lock_is_held(&mylock)" argument,
> the RCU lockdep code would complain only if this instance was
> invoked outside of an RCU read-side critical section and without
> - the protection of mylock.
> + the protection of mylock. :ref:`back <back_to_2>`
> The following diagram shows how each API communicates among the
> reader, updater, and reclaimer.
More information about the Linux-kernel-mentees