diff options
author | Davidlohr Bueso <dave@stgolabs.net> | 2015-02-22 22:31:41 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-02-24 02:44:16 -0500 |
commit | 4d3199e4ca8e6670b54dc5ee070ffd54385988e9 (patch) | |
tree | 5529bcb16c3217c02416e0d17d7c28f277c63581 /include/linux/seqlock.h | |
parent | 2ae79026818e7d49fead82b79b1a543e3b9c8a23 (diff) |
locking: Remove ACCESS_ONCE() usage
With the new standardized functions, we can replace all
ACCESS_ONCE() calls across relevant locking - this includes
lockref and seqlock while at it.
ACCESS_ONCE() does not work reliably on non-scalar types.
For example gcc 4.6 and 4.7 might remove the volatile tag
for such accesses during the SRA (scalar replacement of
aggregates) step:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58145
Update the new calls regardless of if it is a scalar type,
this is cleaner than having three alternatives.
Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/1424662301.6539.18.camel@stgolabs.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/linux/seqlock.h')
-rw-r--r-- | include/linux/seqlock.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h index f5df8f687b4d..5f68d0a391ce 100644 --- a/include/linux/seqlock.h +++ b/include/linux/seqlock.h | |||
@@ -108,7 +108,7 @@ static inline unsigned __read_seqcount_begin(const seqcount_t *s) | |||
108 | unsigned ret; | 108 | unsigned ret; |
109 | 109 | ||
110 | repeat: | 110 | repeat: |
111 | ret = ACCESS_ONCE(s->sequence); | 111 | ret = READ_ONCE(s->sequence); |
112 | if (unlikely(ret & 1)) { | 112 | if (unlikely(ret & 1)) { |
113 | cpu_relax(); | 113 | cpu_relax(); |
114 | goto repeat; | 114 | goto repeat; |
@@ -127,7 +127,7 @@ repeat: | |||
127 | */ | 127 | */ |
128 | static inline unsigned raw_read_seqcount(const seqcount_t *s) | 128 | static inline unsigned raw_read_seqcount(const seqcount_t *s) |
129 | { | 129 | { |
130 | unsigned ret = ACCESS_ONCE(s->sequence); | 130 | unsigned ret = READ_ONCE(s->sequence); |
131 | smp_rmb(); | 131 | smp_rmb(); |
132 | return ret; | 132 | return ret; |
133 | } | 133 | } |
@@ -179,7 +179,7 @@ static inline unsigned read_seqcount_begin(const seqcount_t *s) | |||
179 | */ | 179 | */ |
180 | static inline unsigned raw_seqcount_begin(const seqcount_t *s) | 180 | static inline unsigned raw_seqcount_begin(const seqcount_t *s) |
181 | { | 181 | { |
182 | unsigned ret = ACCESS_ONCE(s->sequence); | 182 | unsigned ret = READ_ONCE(s->sequence); |
183 | smp_rmb(); | 183 | smp_rmb(); |
184 | return ret & ~1; | 184 | return ret & ~1; |
185 | } | 185 | } |