On Fri, Jun 09, 2017 at 04:05:51PM +0800, Junchang Wang wrote: > Switch from ACCESS_ONCE() to READ_ONCE()/WRITE_ONCE(), and updated corresponding > latex file. > > Signed-off-by: Junchang Wang <junchangwang@xxxxxxxxx> Queued and pushed, thank you! Thanx, Paul > --- > CodeSamples/defer/route_refcnt.c | 8 ++++---- > defer/refcnt.tex | 6 +++--- > 2 files changed, 7 insertions(+), 7 deletions(-) > > diff --git a/CodeSamples/defer/route_refcnt.c b/CodeSamples/defer/route_refcnt.c > index 6f8ae65..8a48faf 100644 > --- a/CodeSamples/defer/route_refcnt.c > +++ b/CodeSamples/defer/route_refcnt.c > @@ -35,7 +35,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); > } > > @@ -56,13 +56,13 @@ retry: > do { > if (rep && atomic_dec_and_test(&rep->re_refcnt)) > re_free(rep); > - rep = ACCESS_ONCE(*repp); > + rep = READ_ONCE(*repp); > if (rep == NULL) > return ULONG_MAX; > > /* Acquire a reference if the count is non-zero. */ > do { > - if (ACCESS_ONCE(rep->re_freed)) > + if (READ_ONCE(rep->re_freed)) > abort(); > old = atomic_read(&rep->re_refcnt); > if (old <= 0) > @@ -137,7 +137,7 @@ void route_clear(void) > > spin_lock(&routelock); > rep = route_list.re_next; > - ACCESS_ONCE(route_list.re_next) = NULL; > + WRITE_ONCE(route_list.re_next, NULL); > while (rep != NULL) { > rep1 = rep->re_next; > if (atomic_dec_and_test(&rep->re_refcnt)) > diff --git a/defer/refcnt.tex b/defer/refcnt.tex > index c46fa48..c231961 100644 > --- a/defer/refcnt.tex > +++ b/defer/refcnt.tex > @@ -18,7 +18,7 @@ > 10 > 11 static void re_free(struct route_entry *rep) > 12 { > -13 ACCESS_ONCE(rep->re_freed) = 1; > +13 WRITE_ONCE(rep->re_freed, 1); > 14 free(rep); > 15 } > 16 > @@ -37,11 +37,11 @@ > 29 if (rep && > 30 atomic_dec_and_test(&rep->re_refcnt)) > 31 re_free(rep); > -32 rep = ACCESS_ONCE(*repp); > +32 rep = READ_ONCE(*repp); > 33 if (rep == NULL) > 34 return ULONG_MAX; > 35 do { > -36 if (ACCESS_ONCE(rep->re_freed)) > +36 if (READ_ONCE(rep->re_freed)) > 37 abort(); > 38 old = atomic_read(&rep->re_refcnt); > 39 if (old <= 0) > -- > 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 > -- 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