diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2007-08-22 07:51:45 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2007-08-22 07:51:49 -0400 |
commit | c51b9621796c31810fb66509ea1faee4597d9c03 (patch) | |
tree | 777019f91c931e3d4b8eb06161b19511e0a54af8 /include | |
parent | 9c5f225f1a2c67c57ff5dfbe0589de20c5706a16 (diff) |
[S390] Change atomic_read/set to inline functions with barrier semantics.
After doing some tests this seems to be the best variant for s390 and
should be correct as well. With gcc 4.2.1 we get the following kernel
image sizes using the default configuration:
atomic_t type volatile, atomic_read/set defines 5311824 bytes
atomic_t type int, atomic_read/set defines 5270864 bytes
atomic_t type int, atomic_read/set inline asm 5279056 bytes
atomic_t type int, atomic_read/set inline barrier 5270864 bytes
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-s390/atomic.h | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/include/asm-s390/atomic.h b/include/asm-s390/atomic.h index ea486952f778..2d184655bc5d 100644 --- a/include/asm-s390/atomic.h +++ b/include/asm-s390/atomic.h | |||
@@ -67,8 +67,17 @@ typedef struct { | |||
67 | 67 | ||
68 | #endif /* __GNUC__ */ | 68 | #endif /* __GNUC__ */ |
69 | 69 | ||
70 | #define atomic_read(v) ((v)->counter) | 70 | static inline int atomic_read(const atomic_t *v) |
71 | #define atomic_set(v,i) (((v)->counter) = (i)) | 71 | { |
72 | barrier(); | ||
73 | return v->counter; | ||
74 | } | ||
75 | |||
76 | static inline void atomic_set(atomic_t *v, int i) | ||
77 | { | ||
78 | v->counter = i; | ||
79 | barrier(); | ||
80 | } | ||
72 | 81 | ||
73 | static __inline__ int atomic_add_return(int i, atomic_t * v) | 82 | static __inline__ int atomic_add_return(int i, atomic_t * v) |
74 | { | 83 | { |
@@ -182,8 +191,17 @@ typedef struct { | |||
182 | 191 | ||
183 | #endif /* __GNUC__ */ | 192 | #endif /* __GNUC__ */ |
184 | 193 | ||
185 | #define atomic64_read(v) ((v)->counter) | 194 | static inline long long atomic64_read(const atomic64_t *v) |
186 | #define atomic64_set(v,i) (((v)->counter) = (i)) | 195 | { |
196 | barrier(); | ||
197 | return v->counter; | ||
198 | } | ||
199 | |||
200 | static inline void atomic64_set(atomic64_t *v, long long i) | ||
201 | { | ||
202 | v->counter = i; | ||
203 | barrier(); | ||
204 | } | ||
187 | 205 | ||
188 | static __inline__ long long atomic64_add_return(long long i, atomic64_t * v) | 206 | static __inline__ long long atomic64_add_return(long long i, atomic64_t * v) |
189 | { | 207 | { |