hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
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,7 +22,8 @@
2122 if (likely(old.lock_count == prev.lock_count)) { \
2223 SUCCESS; \
2324 } \
24
- cpu_relax(); \
25
+ if (!--retry) \
26
+ break; \
2527 } \
2628 } while (0)
2729