* [tip:perf/core] tools arch x86: Introduce atomic_cmpxchg()
@ 2017-03-07 7:27 tip-bot for Arnaldo Carvalho de Melo
0 siblings, 0 replies; only message in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2017-03-07 7:27 UTC (permalink / raw)
To: linux-tip-commits
Cc: jolsa, acme, mingo, dsahern, linux-kernel, wangnan0,
elena.reshetova, adrian.hunter, namhyung, tglx, hpa
Commit-ID: 8a73615df3b8973df2de1455c00e9169522d8257
Gitweb: http://git.kernel.org/tip/8a73615df3b8973df2de1455c00e9169522d8257
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Wed, 22 Feb 2017 16:55:43 -0300
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
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 <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Elena Reshetova <elena.reshetova@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-kdmovd3l4gw5b1w31ypr6ddv@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
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 <asm/cmpxchg.h>
+
/*
* 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 */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-03-07 7:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-07 7:27 [tip:perf/core] tools arch x86: Introduce atomic_cmpxchg() tip-bot for Arnaldo Carvalho de Melo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome