mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-14 04:41:26 +00:00
[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>
This commit is contained in:
parent
9c5f225f1a
commit
c51b962179
@ -67,8 +67,17 @@ typedef struct {
|
|||||||
|
|
||||||
#endif /* __GNUC__ */
|
#endif /* __GNUC__ */
|
||||||
|
|
||||||
#define atomic_read(v) ((v)->counter)
|
static inline int atomic_read(const atomic_t *v)
|
||||||
#define atomic_set(v,i) (((v)->counter) = (i))
|
{
|
||||||
|
barrier();
|
||||||
|
return v->counter;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void atomic_set(atomic_t *v, int i)
|
||||||
|
{
|
||||||
|
v->counter = i;
|
||||||
|
barrier();
|
||||||
|
}
|
||||||
|
|
||||||
static __inline__ int atomic_add_return(int i, atomic_t * v)
|
static __inline__ int atomic_add_return(int i, atomic_t * v)
|
||||||
{
|
{
|
||||||
@ -182,8 +191,17 @@ typedef struct {
|
|||||||
|
|
||||||
#endif /* __GNUC__ */
|
#endif /* __GNUC__ */
|
||||||
|
|
||||||
#define atomic64_read(v) ((v)->counter)
|
static inline long long atomic64_read(const atomic64_t *v)
|
||||||
#define atomic64_set(v,i) (((v)->counter) = (i))
|
{
|
||||||
|
barrier();
|
||||||
|
return v->counter;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void atomic64_set(atomic64_t *v, long long i)
|
||||||
|
{
|
||||||
|
v->counter = i;
|
||||||
|
barrier();
|
||||||
|
}
|
||||||
|
|
||||||
static __inline__ long long atomic64_add_return(long long i, atomic64_t * v)
|
static __inline__ long long atomic64_add_return(long long i, atomic64_t * v)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user