From: "Paul E. McKenney" <paulmck@linux.ibm.com>
To: Neeraj Upadhyay <neeraju@codeaurora.org>
Cc: josh@joshtriplett.org, rostedt@goodmis.org,
mathieu.desnoyers@efficios.com, jiangshanlai@gmail.com,
rcu@vger.kernel.org
Subject: Re: [PATCH] rcuupdate: Do a single rhp->func read in rcu_head_after_call_rcu
Date: Mon, 11 Mar 2019 08:48:39 -0700 [thread overview]
Message-ID: <20190311154839.GH13351@linux.ibm.com> (raw)
In-Reply-To: <1552305483-15846-1-git-send-email-neeraju@codeaurora.org>
On Mon, Mar 11, 2019 at 05:28:03PM +0530, Neeraj Upadhyay wrote:
> Read rhp->func pointer in rcu_head_after_call_rcu() only once,
> to avoid warning in the case, where call_rcu() happens between
> two reads of rhp->func.
>
> Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
This would more gracefully handle racing rcu_head_after_call_rcu()
with call_rcu().
But this thing is not yet used, so let's see what Neil Brown says.
If he isn't going to use it, my thought is to instead just remove
this.
Thanx, Paul
> ---
> include/linux/rcupdate.h | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
> index 6cdb1db..174768e 100644
> --- a/include/linux/rcupdate.h
> +++ b/include/linux/rcupdate.h
> @@ -878,9 +878,10 @@ static inline void rcu_head_init(struct rcu_head *rhp)
> static inline bool
> rcu_head_after_call_rcu(struct rcu_head *rhp, rcu_callback_t f)
> {
> - if (READ_ONCE(rhp->func) == f)
> + rcu_callback_t func = READ_ONCE(rhp->func);
> + if (func == f)
> return true;
> - WARN_ON_ONCE(READ_ONCE(rhp->func) != (rcu_callback_t)~0L);
> + WARN_ON_ONCE(func != (rcu_callback_t)~0L);
> return false;
> }
>
> --
> QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
> member of the Code Aurora Forum, hosted by The Linux Foundation
>
next prev parent reply other threads:[~2019-03-11 15:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-11 11:58 [PATCH] rcuupdate: Do a single rhp->func read in rcu_head_after_call_rcu Neeraj Upadhyay
2019-03-11 15:48 ` Paul E. McKenney [this message]
2019-03-11 15:52 ` Neeraj Upadhyay
2019-03-11 22:09 ` Paul E. McKenney
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=20190311154839.GH13351@linux.ibm.com \
--to=paulmck@linux.ibm.com \
--cc=jiangshanlai@gmail.com \
--cc=josh@joshtriplett.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=neeraju@codeaurora.org \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.