[PATCH 2/5] route_rcu: Switch from ACCESS_ONCE() to READ_ONCE()/WRITE_ONCE()

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

 



Signed-off-by: Junchang Wang <junchangwang@xxxxxxxxx>
---
 CodeSamples/defer/route_rcu.c | 6 +++---
 defer/rcuusage.tex            | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/CodeSamples/defer/route_rcu.c b/CodeSamples/defer/route_rcu.c
index 9ac7b25..7716fe8 100644
--- a/CodeSamples/defer/route_rcu.c
+++ b/CodeSamples/defer/route_rcu.c
@@ -44,7 +44,7 @@ DEFINE_SPINLOCK(routelock);
 
 static void re_free(struct route_entry *rep)
 {
-	ACCESS_ONCE(rep->re_freed) = 1;
+	WRITE_ONCE(rep->re_freed, 1);
 	free(rep);
 }
 
@@ -60,7 +60,7 @@ unsigned long route_lookup(unsigned long addr)
 	cds_list_for_each_entry_rcu(rep, &route_list, re_next) {
 		if (rep->addr == addr) {
 			ret = rep->iface;
-			if (ACCESS_ONCE(rep->re_freed))
+			if (READ_ONCE(rep->re_freed))
 				abort();
 			rcu_read_unlock();
 			return ret;
@@ -93,7 +93,7 @@ static void route_cb(struct rcu_head *rhp)
 {
 	struct route_entry *rep = container_of(rhp, struct route_entry, rh);
 
-	ACCESS_ONCE(rep->re_freed) = 1;
+	WRITE_ONCE(rep->re_freed, 1);
 	re_free(rep);
 }
 
diff --git a/defer/rcuusage.tex b/defer/rcuusage.tex
index 0a37312..9a90a14 100644
--- a/defer/rcuusage.tex
+++ b/defer/rcuusage.tex
@@ -64,7 +64,7 @@ Section~\ref{sec:defer:RCU Usage Summary} provides a summary.
 18                               re_next) {
 19     if (rep->addr == addr) {
 20       ret = rep->iface;
-21       if (ACCESS_ONCE(rep->re_freed))
+21       if (READ_ONCE(rep->re_freed))
 22         abort();
 23       rcu_read_unlock();
 24       return ret;
@@ -106,7 +106,7 @@ Section~\ref{sec:defer:RCU Usage Summary} provides a summary.
 20   struct route_entry *rep;
 21
 22   rep = container_of(rhp, struct route_entry, rh);
-23   ACCESS_ONCE(rep->re_freed) = 1;
+23   WRITE_ONCE(rep->re_freed, 1);
 24   free(rep);
 25 }
 26
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe perfbook" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux