From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933356AbbHLMg2 (ORCPT ); Wed, 12 Aug 2015 08:36:28 -0400 Received: from terminus.zytor.com ([198.137.202.10]:42654 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932858AbbHLMg0 (ORCPT ); Wed, 12 Aug 2015 08:36:26 -0400 Date: Wed, 12 Aug 2015 05:35:46 -0700 From: tip-bot for Will Deacon Message-ID: Cc: mingo@kernel.org, will.deacon@arm.com, peterz@infradead.org, tglx@linutronix.de, hpa@zytor.com, Waiman.Long@hp.com, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org Reply-To: mingo@kernel.org, will.deacon@arm.com, peterz@infradead.org, tglx@linutronix.de, hpa@zytor.com, Waiman.Long@hp.com, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org In-Reply-To: <1438880084-18856-6-git-send-email-will.deacon@arm.com> References: <1438880084-18856-6-git-send-email-will.deacon@arm.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:locking/core] locking/qrwlock: Implement queue_write_unlock( ) using smp_store_release() Git-Commit-ID: 2b2a85a4d3534b8884fcfa5bb52837f0e1c672bc X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 2b2a85a4d3534b8884fcfa5bb52837f0e1c672bc Gitweb: http://git.kernel.org/tip/2b2a85a4d3534b8884fcfa5bb52837f0e1c672bc Author: Will Deacon AuthorDate: Thu, 6 Aug 2015 17:54:41 +0100 Committer: Ingo Molnar CommitDate: Wed, 12 Aug 2015 11:59:05 +0200 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 Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Waiman Long Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner 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 --- 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 a8810bf..c537cbb 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 - -#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 #endif /* _ASM_X86_QRWLOCK_H */ diff --git a/include/asm-generic/qrwlock.h b/include/asm-generic/qrwlock.h index deb9e8b..eb673dd 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