diff options
Diffstat (limited to 'include/asm-x86_64/atomic.h')
-rw-r--r-- | include/asm-x86_64/atomic.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/asm-x86_64/atomic.h b/include/asm-x86_64/atomic.h index 4b5cd553e772..cecbf7baa6aa 100644 --- a/include/asm-x86_64/atomic.h +++ b/include/asm-x86_64/atomic.h | |||
@@ -405,8 +405,14 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t *v) | |||
405 | ({ \ | 405 | ({ \ |
406 | int c, old; \ | 406 | int c, old; \ |
407 | c = atomic_read(v); \ | 407 | c = atomic_read(v); \ |
408 | while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \ | 408 | for (;;) { \ |
409 | if (unlikely(c == (u))) \ | ||
410 | break; \ | ||
411 | old = atomic_cmpxchg((v), c, c + (a)); \ | ||
412 | if (likely(old == c)) \ | ||
413 | break; \ | ||
409 | c = old; \ | 414 | c = old; \ |
415 | } \ | ||
410 | c != (u); \ | 416 | c != (u); \ |
411 | }) | 417 | }) |
412 | #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) | 418 | #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) |