Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1199073

[PATCH v4 5/8] locking/qrwlock: implement queue_write_unlock using smp_store_release

From Will Deacon <will.deacon@arm.com>
Newsgroups linux.kernel
Subject [PATCH v4 5/8] locking/qrwlock: implement queue_write_unlock using smp_store_release
Date 2015-08-03 19:10 +0200
Message-ID <pTrps-W6-89@gated-at.bofh.it> (permalink)
References <pTrpn-W6-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Since 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>
---
 arch/x86/include/asm/qrwlock.h | 10 ----------
 include/asm-generic/qrwlock.h  |  9 +--------
 2 files changed, 1 insertion(+), 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 @@
 #define _ASM_X86_QRWLOCK_H
 
 #include <asm-generic/qrwlock_types.h>
-
-#ifndef CONFIG_X86_PPRO_FENCE
-#define queued_write_unlock queued_write_unlock
-static inline void queued_write_unlock(struct qrwlock *lock)
-{
-        barrier();
-        ACCESS_ONCE(*(u8 *)&lock->cnts) = 0;
-}
-#endif
-
 #include <asm-generic/qrwlock.h>
 
 #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)
 	atomic_sub(_QR_BIAS, &lock->cnts);
 }
 
-#ifndef queued_write_unlock
 /**
  * queued_write_unlock - release write lock of a queue rwlock
  * @lock : Pointer to queue rwlock structure
  */
 static inline void queued_write_unlock(struct qrwlock *lock)
 {
-	/*
-	 * If the writer field is atomic, it can be cleared directly.
-	 * Otherwise, an atomic subtraction will be used to clear it.
-	 */
-	smp_mb__before_atomic();
-	atomic_sub(_QW_LOCKED, &lock->cnts);
+	smp_store_release((u8 *)&lock->cnts, 0);
 }
-#endif
 
 /*
  * Remapping rwlock architecture specific functions to the corresponding
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v4 0/8] Add generic support for relaxed atomics Will Deacon <will.deacon@arm.com> - 2015-08-03 19:10 +0200
  [PATCH v4 6/8] locking/qrwlock: make use of acquire/release/relaxed atomics Will Deacon <will.deacon@arm.com> - 2015-08-03 19:10 +0200
    Re: [PATCH v4 6/8] locking/qrwlock: make use of acquire/release/relaxed  atomics Waiman Long <waiman.long@hp.com> - 2015-08-03 22:50 +0200
      Re: [PATCH v4 6/8] locking/qrwlock: make use of  acquire/release/relaxed atomics Will Deacon <will.deacon@arm.com> - 2015-08-04 13:30 +0200
  [PATCH v4 5/8] locking/qrwlock: implement queue_write_unlock using smp_store_release Will Deacon <will.deacon@arm.com> - 2015-08-03 19:10 +0200
    Re: [PATCH v4 5/8] locking/qrwlock: implement queue_write_unlock  using smp_store_release Waiman Long <waiman.long@hp.com> - 2015-08-03 22:50 +0200
  [PATCH v4 7/8] include/llist: use linux/atomic.h instead of asm/cmpxchg.h Will Deacon <will.deacon@arm.com> - 2015-08-03 19:20 +0200
  [PATCH v4 8/8] ARM: atomics: define our SMP atomics in terms of _relaxed operations Will Deacon <will.deacon@arm.com> - 2015-08-03 19:20 +0200
  [PATCH v4 2/8] asm-generic: rework atomic-long.h to avoid bulk code duplication Will Deacon <will.deacon@arm.com> - 2015-08-03 19:20 +0200
  [PATCH v4 1/8] atomics: add acquire/release/relaxed variants of some atomic operations Will Deacon <will.deacon@arm.com> - 2015-08-03 19:20 +0200
    Re: [PATCH v4 1/8] atomics: add acquire/release/relaxed variants of  some atomic operations Peter Zijlstra <peterz@infradead.org> - 2015-08-03 19:30 +0200
      Re: [PATCH v4 1/8] atomics: add acquire/release/relaxed variants of  some atomic operations Will Deacon <will.deacon@arm.com> - 2015-08-03 20:30 +0200
  [PATCH v4 3/8] asm-generic: add relaxed/acquire/release variants for atomic_long_t Will Deacon <will.deacon@arm.com> - 2015-08-03 19:20 +0200

csiph-web