From owner-freebsd-current Mon Feb 18 13:21:12 2002 Delivered-To: freebsd-current@freebsd.org Received: from rwcrmhc52.attbi.com (rwcrmhc52.attbi.com [216.148.227.88]) by hub.freebsd.org (Postfix) with ESMTP id 8144737B417 for ; Mon, 18 Feb 2002 13:20:46 -0800 (PST) Received: from InterJet.elischer.org ([12.232.206.8]) by rwcrmhc52.attbi.com (InterMail vM.4.01.03.27 201-229-121-127-20010626) with ESMTP id <20020218212021.GQLH1147.rwcrmhc52.attbi.com@InterJet.elischer.org>; Mon, 18 Feb 2002 21:20:21 +0000 Received: from localhost (localhost.elischer.org [127.0.0.1]) by InterJet.elischer.org (8.9.1a/8.9.1) with ESMTP id NAA53257; Mon, 18 Feb 2002 13:13:48 -0800 (PST) Date: Mon, 18 Feb 2002 13:13:47 -0800 (PST) From: Julian Elischer To: Matthew Dillon Cc: current@FreeBSD.ORG Subject: Re: Patch to improve mutex collision performance In-Reply-To: <200202182021.g1IKLTM36110@apollo.backplane.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 Mon, 18 Feb 2002, Matthew Dillon wrote: > : > :I can't see any major problem with this but I can't help thinking that > :there must be one.. on UP the question is: "who is going to > :release the lock if no-one is runnable?" > > An interrupt, of course. Wakeups don't happen out of thin air! This > is true of 1.x, 2.x, 3.x, 4.x, 5.x, UP, and SMP. Something needs to > trigger the event that causes the wakeup to occur. > > :can you detail in more clarity the flip-flopping you were seeing? > > Basically what is happening is that switch/wakeup overhead is being > imposed unnecessarily. There is no need to switch if there is nothing > to switch to, and this also causes the other process to not have to > wakeup anyone when it releases Giant because process #1 is spinning > on it instead of sleeping on it. So you immediate remove four context > switches from the critical path. true, though the original code would halt the processor to reduce power consumption on laptops etc. procrunnable doesn't include the idle process. (a side-effect). > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message