From owner-freebsd-current Wed Feb 20 20:48:35 2002 Delivered-To: freebsd-current@freebsd.org Received: from mail5.speakeasy.net (mail5.speakeasy.net [216.254.0.205]) by hub.freebsd.org (Postfix) with ESMTP id ACBD537B41F for ; Wed, 20 Feb 2002 20:48:18 -0800 (PST) Received: (qmail 23516 invoked from network); 21 Feb 2002 04:48:15 -0000 Received: from unknown (HELO laptop.baldwin.cx) ([65.91.152.92]) (envelope-sender ) by mail5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 21 Feb 2002 04:48:15 -0000 Message-ID: X-Mailer: XFMail 1.4.0 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <20020221111915.N65817@wantadilla.lemis.com> Date: Wed, 20 Feb 2002 23:48:12 -0500 (EST) From: John Baldwin To: Greg Lehey Subject: Re: Patch to improve mutex collision performance Cc: current@FreeBSD.ORG, "David O'Brien" , Matthew Dillon , Jake Burkholder Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 21-Feb-02 Greg Lehey wrote: > On Monday, 18 February 2002 at 15:38:07 -0500, Jake Burkholder wrote: >> Apparently, On Mon, Feb 18, 2002 at 11:51:44AM -0800, >> Matthew Dillon said words to the effect of; >>> I'm fairly sure JHB does not have a patch to address this but, please, >>> be my guest and check P4. >> >> Actually he does. Maybe you should have checked p4 first yourself. > > Well, maybe, like me, he doesn't know how. I only recently learnt of > the existence of this repo, and I still don't know where it is. It > certainly wasn't announced on the SMP mailing list. I've seen a few > references to p4 there, but no indication of how to access the repo. > >> What John's patch does is spin while the lock owner is running on >> another cpu. Spinning while there are no other processes on the run >> queues as well makes sense but you'll also be doing a lot of >> acquires and releases of sched_lock. > > I must be misinterpreting this statement. Under what circumstances do > you spin? Yes, I read the "while the owner is running in another > CPU", but the way I read that, it turns the blocking lock into a spin > lock. Only in some cases. This is the classic way of implementing an adaptive mutex. You spin if the other thread is actually executing on another CPU (the idea being it will release the lock soon so you are better off avoiding the context switch) and block if it is not executing on another CPU (releasing the lock is already at least one context switch away, so we might as well switch). > Greg > -- > See complete headers for address and phone numbers > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-current" in the body of the message -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message