lkml.org 
[lkml]   [2014]   [Sep]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH] x86: Use volatile semantics for atomic_set()
Date
All the atomic operations have volatile semantics to prevent compiler
reordering. Enforce the same semantics for atomic_set() too.

Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
---
arch/x86/include/asm/atomic.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/atomic.h b/arch/x86/include/asm/atomic.h
index bf20c81..fa92e93 100644
--- a/arch/x86/include/asm/atomic.h
+++ b/arch/x86/include/asm/atomic.h
@@ -36,7 +36,7 @@ static inline int atomic_read(const atomic_t *v)
*/
static inline void atomic_set(atomic_t *v, int i)
{
- v->counter = i;
+ ACCESS_ONCE(v->counter) = i;
}

/**
--
2.1.0


\
 
 \ /
  Last update: 2014-09-22 22:21    [W:0.039 / U:0.364 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site