[PATCH 01 of 25] bit_lock smp memory barriers

Andrea Arcangeli
2009-11-14T18:10:25Z

Fix bit spinlock to issue the proper memory barries like regular spinlocks.

Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
---

diff --git a/include/linux/bit_spinlock.h b/include/linux/bit_spinlock.h
--- a/include/linux/bit_spinlock.h
+++ b/include/linux/bit_spinlock.h
@@ -26,6 +26,7 @@ static inline void bit_spin_lock(int bit
}
}
#endif
+ smp_mb();
__acquire(bitlock);
}

@@ -41,6 +42,7 @@ static inline int bit_spin_trylock(int b
return 0;
}
#endif
+ smp_mb();
__acquire(bitlock);
return 1;
}
@@ -50,6 +52,7 @@ static inline int bit_spin_trylock(int b
*/
static inline void bit_spin_unlock(int bitnum, unsigned long *addr)
{
+ smp_mb();
#ifdef CONFIG_DEBUG_SPINLOCK
BUG_ON(!test_bit(bitnum, addr));
#endif
@@ -67,6 +70,7 @@ static inline void bit_spin_unlock(int b
*/
static inline void __bit_spin_unlock(int bitnum, unsigned long *addr)
{
+ smp_mb();
#ifdef CONFIG_DEBUG_SPINLOCK
BUG_ON(!test_bit(bitnum, addr));
#endif