Linux Kernel Mentees list
 help / color / mirror / Atom feed
From: corbet at lwn.net (Jonathan Corbet)
Subject: [Linux-kernel-mentees] [PATCH 2/3] Documentation: RCU: Convert RCU linked list to ReST
Date: Sat, 22 Jun 2019 09:00:46 -0600	[thread overview]
Message-ID: <20190622090046.178d9d16@lwn.net> (raw)
In-Reply-To: <20190622070251.GA7182@rYz3n>

On Sat, 22 Jun 2019 02:02:51 -0500
Jiunn Chang <c0d1n61at3 at gmail.com> wrote:

> Convert RCU linked list and add TOC tree hook.
> 
> Signed-off-by: Jiunn Chang <c0d1n61at3 at gmail.com>
> ---
>  Documentation/RCU/index.rst    |   1 +
>  Documentation/RCU/listRCU.txt  | 315 -------------------------------
>  Documentation/RCU/list_rcu.rst | 335 +++++++++++++++++++++++++++++++++
>  Documentation/RCU/rcu.rst      |   4 +-
>  4 files changed, 338 insertions(+), 317 deletions(-)
>  delete mode 100644 Documentation/RCU/listRCU.txt
>  create mode 100644 Documentation/RCU/list_rcu.rst

Sometimes it can be better to do a change like this in two steps, with the
second being just renaming the file.  That can make it easier to see what
has actually changed.

[...]

> diff --git a/Documentation/RCU/list_rcu.rst b/Documentation/RCU/list_rcu.rst
> new file mode 100644
> index 000000000000..255c9e173fba
> --- /dev/null
> +++ b/Documentation/RCU/list_rcu.rst
> @@ -0,0 +1,335 @@
> +.. _list_rcu_doc:
> +
> +Using RCU to Protect Read-Mostly Linked Lists
> +=============================================
> +
> +One of the best applications of RCU is to protect read-mostly linked lists
> +(*struct list_head* in ``list.h``).  One big advantage of this approach
> +is that all of the required memory barriers are included for you in
> +the list macros.  This document describes several applications of RCU,
> +with the best fits first.
> +
> +Example 1: Read-Side Action Taken Outside of Lock, No In-Place Updates
> +----------------------------------------------------------------------
> +
> +The best applications are cases where, if reader-writer locking were
> +used, the read-side lock would be dropped before taking any action
> +based on the results of the search.  The most celebrated example is
> +the routing table.  Because the routing table is tracking the state of
> +equipment outside of the computer, it will at times contain stale data.
> +Therefore, once the route has been computed, there is no need to hold
> +the routing table static during transmission of the packet.  After all,
> +you can hold the routing table static all you want, but that won't keep
> +the external Internet from changing, and it is the state of the external
> +Internet that really matters.  In addition, routing entries are typically
> +added or deleted, rather than being modified in place.
> +
> +A straightforward example of this use of RCU may be found in the
> +system-call auditing support.  For example, a reader-writer locked
> +implementation of *audit_filter_task()* might be as follows:

Please don't mark up function names that way.  Just leave them unadorned,
and soon we'll have the magic to handle all of that automatically.  Also,

> +implementation of *audit_filter_task()* might be as follows:
> +
> +.. code-block:: c
> +
> +   static enum audit_state audit_filter_task(struct task_struct *tsk)

It's usually better to just use "::" to indicate a literal block:

> implementation of audit_filter_task() might be as follows::
>
>    static enum audit_state ....

That minimizes the amount of non-text stuff that readers have to work
through.

Thanks,

jon

WARNING: multiple messages have this Message-ID (diff)
From: corbet@lwn.net (Jonathan Corbet)
Subject: [Linux-kernel-mentees] [PATCH 2/3] Documentation: RCU: Convert RCU linked list to ReST
Date: Sat, 22 Jun 2019 09:00:46 -0600	[thread overview]
Message-ID: <20190622090046.178d9d16@lwn.net> (raw)
Message-ID: <20190622150046.USI35IP1vToSvMniQYPd3QSTjxyWhP4FFNNkebHFqj4@z> (raw)
In-Reply-To: <20190622070251.GA7182@rYz3n>

On Sat, 22 Jun 2019 02:02:51 -0500
Jiunn Chang <c0d1n61at3 at gmail.com> wrote:

> Convert RCU linked list and add TOC tree hook.
> 
> Signed-off-by: Jiunn Chang <c0d1n61at3 at gmail.com>
> ---
>  Documentation/RCU/index.rst    |   1 +
>  Documentation/RCU/listRCU.txt  | 315 -------------------------------
>  Documentation/RCU/list_rcu.rst | 335 +++++++++++++++++++++++++++++++++
>  Documentation/RCU/rcu.rst      |   4 +-
>  4 files changed, 338 insertions(+), 317 deletions(-)
>  delete mode 100644 Documentation/RCU/listRCU.txt
>  create mode 100644 Documentation/RCU/list_rcu.rst

Sometimes it can be better to do a change like this in two steps, with the
second being just renaming the file.  That can make it easier to see what
has actually changed.

[...]

> diff --git a/Documentation/RCU/list_rcu.rst b/Documentation/RCU/list_rcu.rst
> new file mode 100644
> index 000000000000..255c9e173fba
> --- /dev/null
> +++ b/Documentation/RCU/list_rcu.rst
> @@ -0,0 +1,335 @@
> +.. _list_rcu_doc:
> +
> +Using RCU to Protect Read-Mostly Linked Lists
> +=============================================
> +
> +One of the best applications of RCU is to protect read-mostly linked lists
> +(*struct list_head* in ``list.h``).  One big advantage of this approach
> +is that all of the required memory barriers are included for you in
> +the list macros.  This document describes several applications of RCU,
> +with the best fits first.
> +
> +Example 1: Read-Side Action Taken Outside of Lock, No In-Place Updates
> +----------------------------------------------------------------------
> +
> +The best applications are cases where, if reader-writer locking were
> +used, the read-side lock would be dropped before taking any action
> +based on the results of the search.  The most celebrated example is
> +the routing table.  Because the routing table is tracking the state of
> +equipment outside of the computer, it will at times contain stale data.
> +Therefore, once the route has been computed, there is no need to hold
> +the routing table static during transmission of the packet.  After all,
> +you can hold the routing table static all you want, but that won't keep
> +the external Internet from changing, and it is the state of the external
> +Internet that really matters.  In addition, routing entries are typically
> +added or deleted, rather than being modified in place.
> +
> +A straightforward example of this use of RCU may be found in the
> +system-call auditing support.  For example, a reader-writer locked
> +implementation of *audit_filter_task()* might be as follows:

Please don't mark up function names that way.  Just leave them unadorned,
and soon we'll have the magic to handle all of that automatically.  Also,

> +implementation of *audit_filter_task()* might be as follows:
> +
> +.. code-block:: c
> +
> +   static enum audit_state audit_filter_task(struct task_struct *tsk)

It's usually better to just use "::" to indicate a literal block:

> implementation of audit_filter_task() might be as follows::
>
>    static enum audit_state ....

That minimizes the amount of non-text stuff that readers have to work
through.

Thanks,

jon

  parent reply	other threads:[~2019-06-22 15:00 UTC|newest]

Thread overview: 94+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-22  7:02 [Linux-kernel-mentees] [PATCH 2/3] Documentation: RCU: Convert RCU linked list to ReST c0d1n61at3
2019-06-22  7:02 ` Jiunn Chang
2019-06-22 15:00 ` corbet [this message]
2019-06-22 15:00   ` Jonathan Corbet
2019-06-23  8:14   ` [Linux-kernel-mentees] [PATCH v2 0/7] Documentation: RCU: Convert to c0d1n61at3
2019-06-23  8:14     ` Jiunn Chang
2019-06-23 23:39     ` joel
2019-06-23 23:39       ` Joel Fernandes
2019-06-24  0:39     ` corbet
2019-06-24  0:39       ` Jonathan Corbet
2019-06-25  6:26     ` [Linux-kernel-mentees] [PATCH v3 0/6] Documentation: RCU: Convert to reST c0d1n61at3
2019-06-25  6:26       ` Jiunn Chang
2019-06-26 19:12       ` [Linux-kernel-mentees] [PATCH v4 0/5] " c0d1n61at3
2019-06-26 19:12         ` Jiunn Chang
2019-06-26 20:07         ` [Linux-kernel-mentees] [PATCH v5 " c0d1n61at3
2019-06-26 20:07           ` Jiunn Chang
2019-06-26 20:07         ` [Linux-kernel-mentees] [PATCH v5 1/5] Documentation: RCU: Convert RCU basic concepts " c0d1n61at3
2019-06-26 20:07           ` Jiunn Chang
2019-06-27 14:34           ` corbet
2019-06-27 14:34             ` Jonathan Corbet
2019-06-27 15:13             ` rostedt
2019-06-27 15:13               ` Steven Rostedt
2019-06-27 16:48               ` skhan
2019-06-27 16:48                 ` Shuah Khan
2019-06-27 16:26             ` paulmck
2019-06-27 16:26               ` Paul E. McKenney
2019-06-27 16:47             ` c0d1n61at3
2019-06-27 16:47               ` Jiunn Chang
2019-06-26 20:07         ` [Linux-kernel-mentees] [PATCH v5 2/5] Documentation: RCU: Convert RCU linked list " c0d1n61at3
2019-06-26 20:07           ` Jiunn Chang
2019-06-26 20:07         ` [Linux-kernel-mentees] [PATCH v5 3/5] Documentation: RCU: Convert RCU UP systems " c0d1n61at3
2019-06-26 20:07           ` Jiunn Chang
2019-06-26 20:07         ` [Linux-kernel-mentees] [PATCH v5 4/5] Documentation: RCU: Rename txt files to rst c0d1n61at3
2019-06-26 20:07           ` Jiunn Chang
2019-06-26 20:07         ` [Linux-kernel-mentees] [PATCH v5 5/5] Documentation: RCU: Add TOC tree hooks c0d1n61at3
2019-06-26 20:07           ` Jiunn Chang
2019-06-26 19:12       ` [Linux-kernel-mentees] [PATCH v4 1/5] Documentation: RCU: Convert RCU basic concepts to reST c0d1n61at3
2019-06-26 19:12         ` Jiunn Chang
2019-06-26 19:12       ` [Linux-kernel-mentees] [PATCH v4 2/5] Documentation: RCU: Convert RCU linked list " c0d1n61at3
2019-06-26 19:12         ` Jiunn Chang
2019-06-26 19:12       ` [Linux-kernel-mentees] [PATCH v4 3/5] Documentation: RCU: Convert RCU UP systems " c0d1n61at3
2019-06-26 19:12         ` Jiunn Chang
2019-06-26 19:12       ` [Linux-kernel-mentees] [PATCH v4 4/5] Documentation: RCU: Rename txt files to rst c0d1n61at3
2019-06-26 19:12         ` Jiunn Chang
2019-06-26 19:12       ` [Linux-kernel-mentees] [PATCH v4 5/5] Documentation: RCU: Add TOC tree hooks c0d1n61at3
2019-06-26 19:12         ` Jiunn Chang
2019-06-25  6:26     ` [Linux-kernel-mentees] [PATCH v3 1/6] Documentation: RCU: Convert RCU basic concepts to reST c0d1n61at3
2019-06-25  6:26       ` Jiunn Chang
2019-06-25  6:26     ` [Linux-kernel-mentees] [PATCH v3 2/6] Documentation: RCU: Convert RCU linked list " c0d1n61at3
2019-06-25  6:26       ` Jiunn Chang
2019-06-25  6:26     ` [Linux-kernel-mentees] [PATCH v3 3/6] Documentation: RCU: Convert RCU UP systems " c0d1n61at3
2019-06-25  6:26       ` Jiunn Chang
2019-06-25 16:03       ` paulmck
2019-06-25 16:03         ` Paul E. McKenney
2019-06-25  6:26     ` [Linux-kernel-mentees] [PATCH v3 4/6] Documentation: RCU: Rename txt files to rst c0d1n61at3
2019-06-25  6:26       ` Jiunn Chang
2019-06-25  6:26     ` [Linux-kernel-mentees] [PATCH v3 5/6] Documentation: RCU: Add links to rcu.rst c0d1n61at3
2019-06-25  6:26       ` Jiunn Chang
2019-06-25 15:56       ` paulmck
2019-06-25 15:56         ` Paul E. McKenney
2019-06-25 21:01         ` corbet
2019-06-25 21:01           ` Jonathan Corbet
2019-06-25 21:17           ` paulmck
2019-06-25 21:17             ` Paul E. McKenney
2019-06-25 21:40             ` corbet
2019-06-25 21:40               ` Jonathan Corbet
2019-06-25 21:45               ` paulmck
2019-06-25 21:45                 ` Paul E. McKenney
2019-06-25  6:26     ` [Linux-kernel-mentees] [PATCH v3 6/6] Documentation: RCU: Add TOC tree hooks c0d1n61at3
2019-06-25  6:26       ` Jiunn Chang
2019-06-23  8:14   ` [Linux-kernel-mentees] [PATCH v2 1/7] Documentation: RCU: Convert RCU basic concepts to ReST c0d1n61at3
2019-06-23  8:14     ` Jiunn Chang
2019-06-23 23:34     ` joel
2019-06-23 23:34       ` Joel Fernandes
2019-06-23  8:14   ` [Linux-kernel-mentees] [PATCH v2 2/7] Documentation: RCU: Rename " c0d1n61at3
2019-06-23  8:14     ` Jiunn Chang
2019-06-23  8:14   ` [Linux-kernel-mentees] [PATCH v2 3/7] Documentation: RCU: Convert RCU linked list " c0d1n61at3
2019-06-23  8:14     ` Jiunn Chang
2019-06-23 23:31     ` joel
2019-06-23 23:31       ` Joel Fernandes
2019-06-24  0:43     ` corbet
2019-06-24  0:43       ` Jonathan Corbet
2019-06-23  8:14   ` [Linux-kernel-mentees] [PATCH v2 4/7] Documentation: RCU: Rename " c0d1n61at3
2019-06-23  8:14     ` Jiunn Chang
2019-06-23  8:14   ` [Linux-kernel-mentees] [PATCH v2 5/7] Documentation: RCU: Convert RCU UP systems " c0d1n61at3
2019-06-23  8:14     ` Jiunn Chang
2019-06-23 23:27     ` joel
2019-06-23 23:27       ` Joel Fernandes
2019-06-24  0:45     ` corbet
2019-06-24  0:45       ` Jonathan Corbet
2019-06-23  8:14   ` [Linux-kernel-mentees] [PATCH v2 6/7] Documentation: RCU: Rename " c0d1n61at3
2019-06-23  8:14     ` Jiunn Chang
2019-06-23  8:14   ` [Linux-kernel-mentees] [PATCH v2 7/7] Documentation: RCU: Add links to rcu.rst c0d1n61at3
2019-06-23  8:14     ` Jiunn Chang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190622090046.178d9d16@lwn.net \
    --to=linux-kernel-mentees@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox