kernel/lib/lockref.c
.. .. @@ -9,6 +9,7 @@ 9 9 * failure case. 10 10 */ 11 11 #define CMPXCHG_LOOP(CODE, SUCCESS) do { \ 12 + int retry = 100; \12 13 struct lockref old; \ 13 14 BUILD_BUG_ON(sizeof(old) != 8); \ 14 15 old.lock_count = READ_ONCE(lockref->lock_count); \ .. .. @@ -21,6 +22,8 @@ 21 22 if (likely(old.lock_count == prev.lock_count)) { \ 22 23 SUCCESS; \ 23 24 } \ 25 + if (!--retry) \26 + break; \24 27 cpu_relax(); \ 25 28 } \ 26 29 } while (0)