bit_spinlock: don't play preemption games inside the busy loop

When we are waiting for the bit-lock to be released, and are looping
over the 'cpu_relax()' should not be doing anything else - otherwise we
miss the point of trying to do the whole 'cpu_relax()'.

Do the preemption enable/disable around the loop, rather than inside of
it.

Noticed when I was looking at the code generation for the dcache
__d_drop usage, and the code just looked very odd.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

+4 -4
+4 -4
include/linux/bit_spinlock.h
··· 23 23 preempt_disable(); 24 24 #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) 25 25 while (unlikely(test_and_set_bit_lock(bitnum, addr))) { 26 - while (test_bit(bitnum, addr)) { 27 - preempt_enable(); 26 + preempt_enable(); 27 + do { 28 28 cpu_relax(); 29 - preempt_disable(); 30 - } 29 + } while (test_bit(bitnum, addr)); 30 + preempt_disable(); 31 31 } 32 32 #endif 33 33 __acquire(bitlock);