locking/x86: Define arch_try_cmpxchg_local()
authorUros Bizjak <ubizjak@gmail.com>
Wed, 5 Apr 2023 14:17:09 +0000 (16:17 +0200)
committerIngo Molnar <mingo@kernel.org>
Sat, 29 Apr 2023 07:09:23 +0000 (09:09 +0200)
Define target specific arch_try_cmpxchg_local(). This
definition overrides the generic arch_try_cmpxchg_local()
fallback definition and enables target-specific
implementation of try_cmpxchg_local().

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20230405141710.3551-5-ubizjak@gmail.com
Cc: Linus Torvalds <torvalds@linux-foundation.org>
arch/x86/include/asm/cmpxchg.h

index 94fbe6ae74313d397429a0992ba729aedb0ee2ba..540573f515b7bb6cb766fa5218e3af27bcaed83e 100644 (file)
@@ -221,9 +221,15 @@ extern void __add_wrong_size(void)
 #define __try_cmpxchg(ptr, pold, new, size)                            \
        __raw_try_cmpxchg((ptr), (pold), (new), (size), LOCK_PREFIX)
 
+#define __try_cmpxchg_local(ptr, pold, new, size)                      \
+       __raw_try_cmpxchg((ptr), (pold), (new), (size), "")
+
 #define arch_try_cmpxchg(ptr, pold, new)                               \
        __try_cmpxchg((ptr), (pold), (new), sizeof(*(ptr)))
 
+#define arch_try_cmpxchg_local(ptr, pold, new)                         \
+       __try_cmpxchg_local((ptr), (pold), (new), sizeof(*(ptr)))
+
 /*
  * xadd() adds "inc" to "*ptr" and atomically returns the previous
  * value of "*ptr".