Messages in this thread Patch in this message | | | From | guoren@kernel ... | Subject | [PATCH V9 09/15] riscv: cmpxchg: Optimize cmpxchg64 | Date | Mon, 8 Aug 2022 03:13:12 -0400 |
| |
From: Guo Ren <guoren@linux.alibaba.com>
Optimize cmpxchg64 with relaxed, acquire, release implementation.
Signed-off-by: Guo Ren <guoren@linux.alibaba.com> Signed-off-by: Guo Ren <guoren@kernel.org> --- arch/riscv/include/asm/cmpxchg.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
diff --git a/arch/riscv/include/asm/cmpxchg.h b/arch/riscv/include/asm/cmpxchg.h index 14c9280c7f7f..4b5fa25f4336 100644 --- a/arch/riscv/include/asm/cmpxchg.h +++ b/arch/riscv/include/asm/cmpxchg.h @@ -226,6 +226,24 @@ (__cmpxchg_relaxed((ptr), (o), (n), sizeof(*(ptr)))) #ifdef CONFIG_64BIT +#define arch_cmpxchg64_relaxed(ptr, o, n) \ +({ \ + BUILD_BUG_ON(sizeof(*(ptr)) != 8); \ + arch_cmpxchg_relaxed((ptr), (o), (n)); \ +}) + +#define arch_cmpxchg64_acquire(ptr, o, n) \ +({ \ + BUILD_BUG_ON(sizeof(*(ptr)) != 8); \ + arch_cmpxchg_acquire((ptr), (o), (n)); \ +}) + +#define arch_cmpxchg64_release(ptr, o, n) \ +({ \ + BUILD_BUG_ON(sizeof(*(ptr)) != 8); \ + arch_cmpxchg_release((ptr), (o), (n)); \ +}) + #define arch_cmpxchg64(ptr, o, n) \ ({ \ BUILD_BUG_ON(sizeof(*(ptr)) != 8); \ -- 2.36.1
| |