public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] futex: Use atomic64_inc_return() in get_inode_sequence_number()
@ 2024-10-10  7:10 Uros Bizjak
  2024-10-10  7:10 ` [PATCH 2/2] futex: Use atomic64_try_cmpxchg_relaxed() " Uros Bizjak
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Uros Bizjak @ 2024-10-10  7:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Uros Bizjak, Thomas Gleixner, Ingo Molnar, Peter Zijlstra,
	Darren Hart, Davidlohr Bueso, André Almeida

Use atomic64_inc_return(&ref) instead of atomic64_add_return(1, &ref)
to use optimized implementation and ease register pressure around
the primitive for targets that implement optimized variant.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Darren Hart <dvhart@infradead.org>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: "André Almeida" <andrealmeid@igalia.com>
---
 kernel/futex/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/futex/core.c b/kernel/futex/core.c
index 136768ae2637..3146730e55f7 100644
--- a/kernel/futex/core.c
+++ b/kernel/futex/core.c
@@ -181,7 +181,7 @@ static u64 get_inode_sequence_number(struct inode *inode)
 		return old;
 
 	for (;;) {
-		u64 new = atomic64_add_return(1, &i_seq);
+		u64 new = atomic64_inc_return(&i_seq);
 		if (WARN_ON_ONCE(!new))
 			continue;
 
-- 
2.46.2


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

end of thread, other threads:[~2024-10-17 20:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-10  7:10 [PATCH 1/2] futex: Use atomic64_inc_return() in get_inode_sequence_number() Uros Bizjak
2024-10-10  7:10 ` [PATCH 2/2] futex: Use atomic64_try_cmpxchg_relaxed() " Uros Bizjak
2024-10-10 18:06   ` André Almeida
2024-10-17 20:10   ` [tip: locking/core] " tip-bot2 for Uros Bizjak
2024-10-10 18:05 ` [PATCH 1/2] futex: Use atomic64_inc_return() " André Almeida
2024-10-17 20:10 ` [tip: locking/core] " tip-bot2 for Uros Bizjak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox