Re: [PATCH] rcuupdate: Do a single rhp->func read in rcu_head_after_call_rcu

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 3/11/19 9:18 PM, Paul E. McKenney wrote:
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@xxxxxxxxxxxxxx>

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


Agree, makes sense.

Thanks
Neeraj

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



--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
member of the Code Aurora Forum, hosted by The Linux Foundation



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux