diff options
author | Will Deacon <will.deacon@arm.com> | 2015-08-06 12:54:41 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-08-12 05:59:05 -0400 |
commit | 2b2a85a4d3534b8884fcfa5bb52837f0e1c672bc (patch) | |
tree | e81e07f44f5018c49ffda73aefd2e3cc9bb19291 | |
parent | f5468ffde13fc991bd4d6bdec507ffd5777865bd (diff) |
locking/qrwlock: Implement queue_write_unlock() using smp_store_release()
Since the following commit:
536fa402221f ("compiler: Allow 1- and 2-byte smp_load_acquire() and smp_store_release()")
smp_store_release() supports byte accesses, so use that in writer unlock
and remove the conditional macro override.
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Waiman Long <Waiman.Long@hp.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: paulmck@linux.vnet.ibm.com
Link: http://lkml.kernel.org/r/1438880084-18856-6-git-send-email-will.deacon@arm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | arch/x86/include/asm/qrwlock.h | 10 | ||||
-rw-r--r-- | include/asm-generic/qrwlock.h | 9 |
2 files changed, 1 insertions, 18 deletions
diff --git a/arch/x86/include/asm/qrwlock.h b/arch/x86/include/asm/qrwlock.h index a8810bf135ab..c537cbb038a7 100644 --- a/arch/x86/include/asm/qrwlock.h +++ b/arch/x86/include/asm/qrwlock.h | |||
@@ -2,16 +2,6 @@ | |||
2 | #define _ASM_X86_QRWLOCK_H | 2 | #define _ASM_X86_QRWLOCK_H |
3 | 3 | ||
4 | #include <asm-generic/qrwlock_types.h> | 4 | #include <asm-generic/qrwlock_types.h> |
5 | |||
6 | #ifndef CONFIG_X86_PPRO_FENCE | ||
7 | #define queued_write_unlock queued_write_unlock | ||
8 | static inline void queued_write_unlock(struct qrwlock *lock) | ||
9 | { | ||
10 | barrier(); | ||
11 | ACCESS_ONCE(*(u8 *)&lock->cnts) = 0; | ||
12 | } | ||
13 | #endif | ||
14 | |||
15 | #include <asm-generic/qrwlock.h> | 5 | #include <asm-generic/qrwlock.h> |
16 | 6 | ||
17 | #endif /* _ASM_X86_QRWLOCK_H */ | 7 | #endif /* _ASM_X86_QRWLOCK_H */ |
diff --git a/include/asm-generic/qrwlock.h b/include/asm-generic/qrwlock.h index deb9e8b0eb9e..eb673dde8879 100644 --- a/include/asm-generic/qrwlock.h +++ b/include/asm-generic/qrwlock.h | |||
@@ -134,21 +134,14 @@ static inline void queued_read_unlock(struct qrwlock *lock) | |||
134 | atomic_sub(_QR_BIAS, &lock->cnts); | 134 | atomic_sub(_QR_BIAS, &lock->cnts); |
135 | } | 135 | } |
136 | 136 | ||
137 | #ifndef queued_write_unlock | ||
138 | /** | 137 | /** |
139 | * queued_write_unlock - release write lock of a queue rwlock | 138 | * queued_write_unlock - release write lock of a queue rwlock |
140 | * @lock : Pointer to queue rwlock structure | 139 | * @lock : Pointer to queue rwlock structure |
141 | */ | 140 | */ |
142 | static inline void queued_write_unlock(struct qrwlock *lock) | 141 | static inline void queued_write_unlock(struct qrwlock *lock) |
143 | { | 142 | { |
144 | /* | 143 | smp_store_release((u8 *)&lock->cnts, 0); |
145 | * If the writer field is atomic, it can be cleared directly. | ||
146 | * Otherwise, an atomic subtraction will be used to clear it. | ||
147 | */ | ||
148 | smp_mb__before_atomic(); | ||
149 | atomic_sub(_QW_LOCKED, &lock->cnts); | ||
150 | } | 144 | } |
151 | #endif | ||
152 | 145 | ||
153 | /* | 146 | /* |
154 | * Remapping rwlock architecture specific functions to the corresponding | 147 | * Remapping rwlock architecture specific functions to the corresponding |