summaryrefslogtreecommitdiff
path: root/lib/lockref.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-06-17 11:23:24 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-06-17 11:23:24 +0200
commita954e5fb4bc2d401b8fc3b4c7cd316497ff80225 (patch)
tree06af23b232c7c2e795a2fef8a5a0604ec64d5092 /lib/lockref.c
parente137d34f94ebcb6508d7c8614ac045583fffbe2a (diff)
parent9e0babf2c06c73cda2c0cd37a1653d823adb40ec (diff)
Merge 5.2-rc5 into usb-next
We need the USB fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.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)