From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754720AbdCGHfS (ORCPT ); Tue, 7 Mar 2017 02:35:18 -0500 Received: from terminus.zytor.com ([65.50.211.136]:60756 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750918AbdCGHfK (ORCPT ); Tue, 7 Mar 2017 02:35:10 -0500 Date: Mon, 6 Mar 2017 23:27:14 -0800 From: tip-bot for Arnaldo Carvalho de Melo Message-ID: Cc: jolsa@kernel.org, acme@redhat.com, mingo@kernel.org, dsahern@gmail.com, linux-kernel@vger.kernel.org, wangnan0@huawei.com, elena.reshetova@intel.com, adrian.hunter@intel.com, namhyung@kernel.org, tglx@linutronix.de, hpa@zytor.com Reply-To: tglx@linutronix.de, namhyung@kernel.org, hpa@zytor.com, dsahern@gmail.com, jolsa@kernel.org, acme@redhat.com, mingo@kernel.org, wangnan0@huawei.com, linux-kernel@vger.kernel.org, elena.reshetova@intel.com, adrian.hunter@intel.com To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] tools arch x86: Introduce atomic_cmpxchg() Git-Commit-ID: 8a73615df3b8973df2de1455c00e9169522d8257 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 8a73615df3b8973df2de1455c00e9169522d8257 Gitweb: http://git.kernel.org/tip/8a73615df3b8973df2de1455c00e9169522d8257 Author: Arnaldo Carvalho de Melo AuthorDate: Wed, 22 Feb 2017 16:55:43 -0300 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 3 Mar 2017 19:07:13 -0300 tools arch x86: Introduce atomic_cmpxchg() Will be used by atomic_cmpxchg_relaxed(), in turn used by refcount.h. Cc: Adrian Hunter Cc: David Ahern Cc: Elena Reshetova Cc: Jiri Olsa Cc: Namhyung Kim Cc: Wang Nan Link: http://lkml.kernel.org/n/tip-kdmovd3l4gw5b1w31ypr6ddv@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/arch/x86/include/asm/atomic.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/arch/x86/include/asm/atomic.h b/tools/arch/x86/include/asm/atomic.h index 059e33e..328eece 100644 --- a/tools/arch/x86/include/asm/atomic.h +++ b/tools/arch/x86/include/asm/atomic.h @@ -7,6 +7,8 @@ #define LOCK_PREFIX "\n\tlock; " +#include + /* * Atomic operations that C can't guarantee us. Useful for * resource counting etc.. @@ -62,4 +64,9 @@ static inline int atomic_dec_and_test(atomic_t *v) GEN_UNARY_RMWcc(LOCK_PREFIX "decl", v->counter, "%0", "e"); } +static __always_inline int atomic_cmpxchg(atomic_t *v, int old, int new) +{ + return cmpxchg(&v->counter, old, new); +} + #endif /* _TOOLS_LINUX_ASM_X86_ATOMIC_H */