Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Thu, 31 Jan 2002 19:02:37 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Thu, 31 Jan 2002 19:02:27 -0500 Received: from parcelfarce.linux.theplanet.co.uk ([195.92.249.252]:39432 "EHLO www.linux.org.uk") by vger.kernel.org with ESMTP id ; Thu, 31 Jan 2002 19:02:19 -0500 Message-ID: <3C59D956.4F2B85DB@zip.com.au> Date: Thu, 31 Jan 2002 15:55:02 -0800 From: Andrew Morton X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.4.18-pre7 i686) X-Accept-Language: en MIME-Version: 1.0 To: Bob Miller CC: linux-kernel@vger.kernel.org Subject: Re: [PATCH] 2.5.3 remove global semaphore_lock spin lock. In-Reply-To: <20020131150139.A1345@doc.pdx.osdl.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Bob Miller wrote: > > Below is a patch for i386 that replaces the global spin lock semaphore_lock, > with the rwlock_t embedded in the wait_queue_head_t in the struct semaphore. > Looks sane. In practice, the speedup is unmeasurable, but... > ... > + unsigned long flags; > + wq_write_lock_irqsave(&sem->wait.lock, flags); > - spin_lock_irq(&semaphore_lock); I rather dislike spin_lock_irq(), because it's fragile (makes assumptions about the caller's state). But in this case, it's probably a reasonable micro-optimisation to not have to save the flags. Nobody should be calling down() with local interrupts disabled. > ... > +/* > + * Same as __wake_up but called with the wait_queue_head_t lock held > + * in at least read mode. > + */ > +void __wake_up_locked(wait_queue_head_t *q, unsigned int mode, int nr) > +{ > + if (q) { I don't think we need to test `q' here. It's a new function, and we don't need to support broken callers. So __wake_up_locked() can become a macro direct call to __wake_up_common(). > + __wake_up_common(q, mode, nr, 0); This one breaks the camel's back :) Let's un-inline __wake_up_common and EXPORT_SYMBOL it. It'd be good if you could also verify that the code still works when the use-rwlocks-for-waitqueues option is turned on. (wait.h:USE_RW_WAIT_QUEUE_SPINLOCK) - - 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/