Skip to content

locking/lockref: Use try_cmpxchg64 in CMPXCHG_LOOP macro

Uros Bizjak linuxppc-dev lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 11 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2locking/lockref: Use try_cmpxchg64 in CMPXCHG_LOOP macrolib/lockref.c+4 -57 replies
2/2locking/lockref/x86: Enable ARCH_USE_CMPXCHG_LOCKREF for X86_32 && X86_CMPXCHG64arch/x86/Kconfig+1 -14 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] locking/lockref: Use try_cmpxchg64 in CMPXCHG_LOOP macro

This patch series introduces try_cmpxchg64 into CMPXCHG_LOOP macro to improve generated code a bit. x86 CMPXCHG instruction returns success in ZF flag, so a compare after CMPXCHG and a related move instruction can be eliminated.

The second patch (optionally) enables lockless reference count updates for X86_32 target with X86_CMPXCHG64 config flag set. When try_cmpxchg64 is used in CMPXCHG_LOOP macro in lib/lockref.c, the compiler avoids double-word compare and related move and produces quite optimal code around CMPXCHG8B for a register starved X86_32 target.

---
Uros Bizjak (2):
locking/lockref: Use try_cmpxchg64 in CMPXCHG_LOOP macro locking/lockref/x86: Enable ARCH_USE_CMPXCHG_LOCKREF for X86_32 &&

    X86_CMPXCHG64
 arch/x86/Kconfig | 2 +-
 lib/lockref.c    | 9 ++++-----
 2 files changed, 5 insertions(+), 6 deletions(-)
Signature · 1 line
2.35.3