From: Uros Bizjak <ubizjak@gmail.com>
To: x86@kernel.org, linux-kernel@vger.kernel.org
Cc: Uros Bizjak <ubizjak@gmail.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
Waiman.Long@hp.com, paulmck@linux.vnet.ibm.com
Subject: [PATCH 0/2] locking/lockref: Use try_cmpxchg64 in CMPXCHG_LOOP macro
Date: Wed, 25 May 2022 16:40:11 +0200 [thread overview]
Message-ID: <20220525144013.6481-1-ubizjak@gmail.com> (raw)
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
next reply other threads:[~2022-05-25 14:40 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-25 14:40 Uros Bizjak [this message]
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:42 ` Mark Rutland
2022-05-27 9:36 ` Heiko Carstens
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220525144013.6481-1-ubizjak@gmail.com \
--to=ubizjak@gmail.com \
--cc=Waiman.Long@hp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®