summaryrefslogtreecommitdiffstats
path: root/lib/lockref.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2019-06-17 12:12:27 +0200
committerIngo Molnar <mingo@kernel.org>2019-06-17 12:12:27 +0200
commit23da766ab1dc005860b675bf048226a11a748bf9 (patch)
tree3f8dbfc2cf68f5da3faa3a377087b06dd8ad343d /lib/lockref.c
parentaf75d1a9a9f75bf030c2f35705f1ff6d226f96fe (diff)
parent9e0babf2c06c73cda2c0cd37a1653d823adb40ec (diff)
downloadlinux-23da766ab1dc005860b675bf048226a11a748bf9.tar.bz2
Merge tag 'v5.2-rc5' into sched/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'lib/lockref.c')
-rw-r--r--lib/lockref.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/lockref.c b/lib/lockref.c
index 3d468b53d4c9..5b34bbd3eba8 100644
--- a/lib/lockref.c
+++ b/lib/lockref.c
@@ -9,6 +9,7 @@
* failure case.
*/
#define CMPXCHG_LOOP(CODE, SUCCESS) do { \
+ int retry = 100; \
struct lockref old; \
BUILD_BUG_ON(sizeof(old) != 8); \
old.lock_count = READ_ONCE(lockref->lock_count); \
@@ -21,6 +22,8 @@
if (likely(old.lock_count == prev.lock_count)) { \
SUCCESS; \
} \
+ if (!--retry) \
+ break; \
cpu_relax(); \
} \
} while (0)