All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rcuupdate: Do a single rhp->func read in rcu_head_after_call_rcu
@ 2019-03-11 11:58 Neeraj Upadhyay
  2019-03-11 15:48 ` Paul E. McKenney
  0 siblings, 1 reply; 4+ messages in thread
From: Neeraj Upadhyay @ 2019-03-11 11:58 UTC (permalink / raw)
  To: paulmck, josh, rostedt, mathieu.desnoyers, jiangshanlai
  Cc: rcu, Neeraj Upadhyay

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>
---
 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-03-11 22:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2019-03-11 15:52   ` Neeraj Upadhyay
2019-03-11 22:09     ` Paul E. McKenney

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.