From owner-freebsd-arch@FreeBSD.ORG Wed Mar 19 19:29:42 2008 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7841C106566B; Wed, 19 Mar 2008 19:29:42 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from speedfactory.net (mail.speedfactory.net [66.23.216.219]) by mx1.freebsd.org (Postfix) with ESMTP id 602C88FC15; Wed, 19 Mar 2008 19:29:41 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (unverified [66.23.211.162]) by speedfactory.net (SurgeMail 3.8s) with ESMTP id 236055968-1834499 for multiple; Wed, 19 Mar 2008 15:30:39 -0400 Received: from localhost.corp.yahoo.com (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.14.2/8.14.2) with ESMTP id m2JJTTcq005262; Wed, 19 Mar 2008 15:29:29 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: freebsd-arch@freebsd.org Date: Wed, 19 Mar 2008 15:26:56 -0400 User-Agent: KMail/1.9.7 References: <20080307020626.G920@desktop> <20080318235125.G910@desktop> <20080319172344.GX67856@elvis.mu.org> In-Reply-To: <20080319172344.GX67856@elvis.mu.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200803191526.56761.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Wed, 19 Mar 2008 15:29:30 -0400 (EDT) X-Virus-Scanned: ClamAV 0.91.2/6305/Wed Mar 19 03:32:53 2008 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: Daniel Eischen , Alfred Perlstein , David Xu , arch@freebsd.org Subject: Re: Getting rid of the static msleep priority boost X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Mar 2008 19:29:42 -0000 On Wednesday 19 March 2008 01:23:44 pm Alfred Perlstein wrote: > * Jeff Roberson [080319 02:51] wrote: > > On Wed, 19 Mar 2008, David Xu wrote: > > > > >Daniel Eischen wrote: > > > > > >>I'm not sure if any of the above remove the priority from the API, > > >>but it would be nice to get rid of msleep totally and replace it > > >>with an equivalent cv_wait(). > > >> > > > > > >And create sleep queue in each cv to get rid of shared sleep queue > > >lock ? > > > > Some spinlock is required to interlock with the scheduler lock via > > thread_lock(). So I don't think you can get rid of that layer. You also > > wouldn't want to have the cost of a 'struct sleepqueue' everywhere you > > want a msleep/condvar. > > > > I personally don't see any real advantage to using condvar everywhere. > > The only thing you really get is protection against spurious wakeups. > > In theory can't you protect the waitq hung off of condvars with > the mutex/spinlock used for the condvar instead of a global > (hashed) lock on the global waitq? Right now we let people invoke cv_wakeup/signal w/o holding the lock. I actually took the thread queue out of condvar's back when doing the original sleep queue stuff since it is cheaper space wise. Instead of each possible condvar having its own set of queue pointers you just have a set of queue pointers for each thread in the system. Similar to only have a turnstile per thread rather than per lock. -- John Baldwin