diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2007-05-13 15:56:58 -0400 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2007-05-13 15:56:58 -0400 |
commit | a7047a53508e7f13f5eaad05ced71a4536f0126f (patch) | |
tree | 4e32dd23718eb857985dc85ee33bfe5795b12c57 /include/linux/queuelock.h | |
parent | d620b1d13eab024fa5f64480724c133c28ea3dd7 (diff) |
Use volatile access and relax_cpu() in queue lock.
Diffstat (limited to 'include/linux/queuelock.h')
-rw-r--r-- | include/linux/queuelock.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/include/linux/queuelock.h b/include/linux/queuelock.h index 3fad15deab..454ff817fb 100644 --- a/include/linux/queuelock.h +++ b/include/linux/queuelock.h | |||
@@ -58,6 +58,7 @@ static inline void queue_lock_init(queuelock_t *lock) | |||
58 | static inline void queue_lock(queuelock_t *lock) | 58 | static inline void queue_lock(queuelock_t *lock) |
59 | { | 59 | { |
60 | int me = smp_processor_id(); | 60 | int me = smp_processor_id(); |
61 | volatile int* spin_var; | ||
61 | /* Get slot to spin on. atomic_inc_return() returns the incremented | 62 | /* Get slot to spin on. atomic_inc_return() returns the incremented |
62 | * value, so take one of again | 63 | * value, so take one of again |
63 | */ | 64 | */ |
@@ -71,9 +72,9 @@ static inline void queue_lock(queuelock_t *lock) | |||
71 | /* range limit*/ | 72 | /* range limit*/ |
72 | lock->spin_slot[me] %= NR_CPUS; | 73 | lock->spin_slot[me] %= NR_CPUS; |
73 | /* spin until you acquire the lock */ | 74 | /* spin until you acquire the lock */ |
74 | while (lock->slots[lock->spin_slot[me]].val == MUST_WAIT) | 75 | spin_var = (int*) &lock->slots[lock->spin_slot[me]].val; |
75 | // rep_nop(); | 76 | while (*spin_var == MUST_WAIT) |
76 | ; | 77 | cpu_relax(); |
77 | 78 | ||
78 | /* reset the lock */ | 79 | /* reset the lock */ |
79 | lock->slots[lock->spin_slot[me]].val = MUST_WAIT; | 80 | lock->slots[lock->spin_slot[me]].val = MUST_WAIT; |