All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lockref: Relax in cmpxchg loop
@ 2013-09-03 21:49 Luck, Tony
  0 siblings, 0 replies; only message in thread
From: Luck, Tony @ 2013-09-03 21:49 UTC (permalink / raw)
  To: Linus Torvalds, linux-kernel

While we are likley to succeed and break out of this loop, it isn't
guaranteed.  We should be power and thread friendly if we do have to
go around for a second (or third, or more) attempt.

Signed-off-by: Tony Luck <tony.luck@intel.com>

---

diff --git a/lib/lockref.c b/lib/lockref.c
index 7819c2d..9d76f40 100644
--- a/lib/lockref.c
+++ b/lib/lockref.c
@@ -19,6 +19,7 @@
 		if (likely(old.lock_count == prev.lock_count)) {		\
 			SUCCESS;						\
 		}								\
+		cpu_relax();							\
 	}									\
 } while (0)
 
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-09-03 22:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-03 21:49 [PATCH] lockref: Relax in cmpxchg loop Luck, Tony

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.