From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Kees Cook <keescook@chromium.org>
Cc: linux-kernel@vger.kernel.org,
Dipankar Sarma <dipankar@in.ibm.com>,
Rob Landley <rob@landley.net>,
linux-doc@vger.kernel.org
Subject: Re: [PATCH] RCU: update docs to include kfree_rcu()
Date: Sat, 20 Oct 2012 14:37:48 -0700 [thread overview]
Message-ID: <20121020213748.GQ2518@linux.vnet.ibm.com> (raw)
In-Reply-To: <20121019164830.GA4896@www.outflux.net>
On Fri, Oct 19, 2012 at 09:48:30AM -0700, Kees Cook wrote:
> Mention kfree_rcu() in the call_rcu() section. Additionally fix the
> example code for list replacement that used the wrong structure element.
Good catch! Queued, and thank you for your review and feedback! ;-)
Thanx, Paul
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
> Documentation/RCU/listRCU.txt | 2 +-
> Documentation/RCU/whatisRCU.txt | 13 +++++++++++--
> 2 files changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/RCU/listRCU.txt b/Documentation/RCU/listRCU.txt
> index 4349c14..adb5a37 100644
> --- a/Documentation/RCU/listRCU.txt
> +++ b/Documentation/RCU/listRCU.txt
> @@ -205,7 +205,7 @@ RCU ("read-copy update") its name. The RCU code is as follows:
> audit_copy_rule(&ne->rule, &e->rule);
> ne->rule.action = newaction;
> ne->rule.file_count = newfield_count;
> - list_replace_rcu(e, ne);
> + list_replace_rcu(&e->list, &ne->list);
> call_rcu(&e->rcu, audit_free_rule);
> return 0;
> }
> diff --git a/Documentation/RCU/whatisRCU.txt b/Documentation/RCU/whatisRCU.txt
> index bf0f6de..160ac55 100644
> --- a/Documentation/RCU/whatisRCU.txt
> +++ b/Documentation/RCU/whatisRCU.txt
> @@ -499,6 +499,8 @@ The foo_reclaim() function might appear as follows:
> {
> struct foo *fp = container_of(rp, struct foo, rcu);
>
> + foo_cleanup(fp->a);
> +
> kfree(fp);
> }
>
> @@ -521,6 +523,12 @@ o Use call_rcu() -after- removing a data element from an
> read-side critical sections that might be referencing that
> data item.
>
> +If the callback for call_rcu() is not doing anything more than calling
> +kfree() on the structure, you can use kfree_rcu() instead of call_rcu()
> +to avoid having to write your own callback:
> +
> + kfree_rcu(old_fp, rcu);
> +
> Again, see checklist.txt for additional rules governing the use of RCU.
>
>
> @@ -773,8 +781,8 @@ a single atomic update, converting to RCU will require special care.
>
> Also, the presence of synchronize_rcu() means that the RCU version of
> delete() can now block. If this is a problem, there is a callback-based
> -mechanism that never blocks, namely call_rcu(), that can be used in
> -place of synchronize_rcu().
> +mechanism that never blocks, namely call_rcu() or kfree_rcu(), that can
> +be used in place of synchronize_rcu().
>
>
> 7. FULL LIST OF RCU APIs
> @@ -813,6 +821,7 @@ RCU: Critical sections Grace period Barrier
> rcu_read_unlock synchronize_rcu
> rcu_dereference synchronize_rcu_expedited
> call_rcu
> + kfree_rcu
>
>
> bh: Critical sections Grace period Barrier
> --
> 1.7.9.5
>
>
> --
> Kees Cook
> Chrome OS Security
>
prev parent reply other threads:[~2012-10-20 21:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-19 16:48 [PATCH] RCU: update docs to include kfree_rcu() Kees Cook
2012-10-20 21:37 ` Paul E. McKenney [this message]
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=20121020213748.GQ2518@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=dipankar@in.ibm.com \
--cc=keescook@chromium.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rob@landley.net \
/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;
as well as URLs for NNTP newsgroup(s).