hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/lib/lockref.c
....@@ -9,6 +9,7 @@
99 * failure case.
1010 */
1111 #define CMPXCHG_LOOP(CODE, SUCCESS) do { \
12
+ int retry = 100; \
1213 struct lockref old; \
1314 BUILD_BUG_ON(sizeof(old) != 8); \
1415 old.lock_count = READ_ONCE(lockref->lock_count); \
....@@ -21,6 +22,8 @@
2122 if (likely(old.lock_count == prev.lock_count)) { \
2223 SUCCESS; \
2324 } \
25
+ if (!--retry) \
26
+ break; \
2427 cpu_relax(); \
2528 } \
2629 } while (0)