aboutsummaryrefslogtreecommitdiffstats
path: root/lib/lockref.c
diff options
context:
space:
mode:
authorLuck, Tony <[email protected]>2013-09-03 21:49:49 +0000
committerLinus Torvalds <[email protected]>2013-09-03 22:36:42 +0000
commitd472d9d98b463dd7a04f2bcdeafe4261686ce6ab (patch)
tree05972418a7e71d3e8d5a9c8c8d5e1dc22f013c5b /lib/lockref.c
parentMerge tag 'tty-3.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gre... (diff)
downloadkernel-d472d9d98b463dd7a04f2bcdeafe4261686ce6ab.tar.gz
kernel-d472d9d98b463dd7a04f2bcdeafe4261686ce6ab.zip
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 <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'lib/lockref.c')
-rw-r--r--lib/lockref.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/lockref.c b/lib/lockref.c
index 7819c2d1d315..9d76f404ce9a 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)