All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] locking/lockref: Use try_cmpxchg64 in CMPXCHG_LOOP macro
@ 2022-05-25 14:40 Uros Bizjak
  2022-05-25 14:40 ` [PATCH 1/2] " Uros Bizjak
  2022-05-25 14:40 ` [PATCH 2/2] locking/lockref/x86: Enable ARCH_USE_CMPXCHG_LOCKREF for X86_32 && X86_CMPXCHG64 Uros Bizjak
  0 siblings, 2 replies; 18+ messages in thread
From: Uros Bizjak @ 2022-05-25 14:40 UTC (permalink / raw)
  To: x86, linux-kernel
  Cc: Uros Bizjak, Linus Torvalds, Peter Zijlstra, Thomas Gleixner,
	Waiman.Long, paulmck

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.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Waiman.Long@hp.com
Cc: paulmck@linux.vnet.ibm.com
---
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(-)

-- 
2.35.3


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2022-05-27  9:37 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-25 14:40 [PATCH 0/2] locking/lockref: Use try_cmpxchg64 in CMPXCHG_LOOP macro Uros Bizjak
2022-05-25 14:40 ` [PATCH 1/2] " Uros Bizjak
2022-05-25 16:47   ` Linus Torvalds
2022-05-26  8:54     ` Uros Bizjak
2022-05-26 12:14     ` Michael Ellerman
2022-05-26 12:14       ` Michael Ellerman
2022-05-26 12:42       ` Mark Rutland
2022-05-26 12:42         ` Mark Rutland
2022-05-27  9:36         ` Heiko Carstens
2022-05-27  9:36           ` Heiko Carstens
2022-05-26 16:52       ` Linus Torvalds
2022-05-26 16:52         ` Linus Torvalds
2022-05-26 16:56     ` Linus Torvalds
2022-05-25 14:40 ` [PATCH 2/2] locking/lockref/x86: Enable ARCH_USE_CMPXCHG_LOCKREF for X86_32 && X86_CMPXCHG64 Uros Bizjak
2022-05-25 16:29   ` Linus Torvalds
2022-05-26  8:30     ` David Laight
2022-05-26  9:12       ` Uros Bizjak
2022-05-26 17:23       ` Linus Torvalds

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.