From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S262194AbVATQuI (ORCPT ); Thu, 20 Jan 2005 11:50:08 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S262189AbVATQrD (ORCPT ); Thu, 20 Jan 2005 11:47:03 -0500 Received: from mx2.elte.hu ([157.181.151.9]:28592 "EHLO mx2.elte.hu") by vger.kernel.org with ESMTP id S262194AbVATQla (ORCPT ); Thu, 20 Jan 2005 11:41:30 -0500 Date: Thu, 20 Jan 2005 17:40:38 +0100 From: Ingo Molnar To: Linus Torvalds Cc: Peter Chubb , Chris Wedgwood , Andrew Morton , paulus@samba.org, linux-kernel@vger.kernel.org, tony.luck@intel.com, dsw@gelato.unsw.edu.au, benh@kernel.crashing.org, linux-ia64@vger.kernel.org, hch@infradead.org, wli@holomorphy.com, jbarnes@sgi.com Subject: Re: [patch 1/3] spinlock fix #1, *_can_lock() primitives Message-ID: <20050120164038.GA15874@elte.hu> References: <16878.9678.73202.771962@wombat.chubb.wattle.id.au> <20050119092013.GA2045@elte.hu> <16878.54402.344079.528038@cargo.ozlabs.ibm.com> <20050120023445.GA3475@taniwha.stupidest.org> <20050119190104.71f0a76f.akpm@osdl.org> <20050120031854.GA8538@taniwha.stupidest.org> <16879.29449.734172.893834@wombat.chubb.wattle.id.au> <20050120160839.GA13067@elte.hu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.1i X-ELTE-SpamVersion: MailScanner 4.31.6-itk1 (ELTE 1.2) SpamAssassin 2.63 ClamAV 0.73 X-ELTE-VirusStatus: clean X-ELTE-SpamCheck: no X-ELTE-SpamCheck-Details: score=-4.9, required 5.9, autolearn=not spam, BAYES_00 -4.90 X-ELTE-SpamLevel: X-ELTE-SpamScore: -4 Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org * Linus Torvalds wrote: > I can do ppc64 myself, can others fix the other architectures (Ingo, > shouldn't the UP case have the read/write_can_lock() cases too? And > wouldn't you agree that it makes more sense to have the rwlock test > variants in asm/rwlock.h?): You are right about UP, and the patch below adds the UP variants. It's analogous to the existing wrapping concept that UP 'spinlocks' are always unlocked on UP. (spin_can_lock() is already properly defined on UP too.) Ingo Signed-off-by: Ingo Molnar --- linux/include/linux/spinlock.h.orig +++ linux/include/linux/spinlock.h @@ -228,6 +228,9 @@ typedef struct { #define rwlock_yield(lock) (void)(lock) +#define read_can_lock(lock) (((void)(lock), 1)) +#define write_can_lock(lock) (((void)(lock), 1)) + #define _spin_trylock(lock) ({preempt_disable(); _raw_spin_trylock(lock) ? \ 1 : ({preempt_enable(); 0;});})