From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754565AbaIVTjZ (ORCPT ); Mon, 22 Sep 2014 15:39:25 -0400 Received: from mail-yk0-f169.google.com ([209.85.160.169]:59025 "EHLO mail-yk0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751130AbaIVTjY (ORCPT ); Mon, 22 Sep 2014 15:39:24 -0400 From: Pranith Kumar To: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org (maintainer:X86 ARCHITECTURE...), Peter Zijlstra , "Paul E. McKenney" , linux-kernel@vger.kernel.org (open list:X86 ARCHITECTURE...) Subject: [RFC PATCH] x86: Use volatile semantics for atomic_set() Date: Mon, 22 Sep 2014 15:39:21 -0400 Message-Id: <1411414762-32366-1-git-send-email-bobby.prani@gmail.com> X-Mailer: git-send-email 2.1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org All the atomic operations have volatile semantics to prevent compiler reordering. Enforce the same semantics for atomic_set() too. Signed-off-by: Pranith Kumar --- 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