lkml.org 
[lkml]   [2013]   [Sep]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subject[PATCH] lockref: Relax in cmpxchg loop
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


\
 
 \ /
  Last update: 2013-09-04 00:21    [W:0.056 / U:0.276 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site