From owner-cvs-all@FreeBSD.ORG Mon Aug 30 20:58:07 2004 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A88D716A4CE for ; Mon, 30 Aug 2004 20:58:07 +0000 (GMT) Received: from mail3.speakeasy.net (mail3.speakeasy.net [216.254.0.203]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7753443D5E for ; Mon, 30 Aug 2004 20:58:07 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: (qmail 17527 invoked from network); 30 Aug 2004 20:58:06 -0000 Received: from dsl027-160-063.atl1.dsl.speakeasy.net (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) encrypted SMTP for ; 30 Aug 2004 20:58:06 -0000 Received: from [10.50.41.228] (gw1.twc.weather.com [216.133.140.1]) (authenticated bits=0) by server.baldwin.cx (8.12.11/8.12.11) with ESMTP id i7UKvvMm045297; Mon, 30 Aug 2004 16:58:03 -0400 (EDT) (envelope-from jhb@FreeBSD.org) From: John Baldwin To: Max Laier Date: Mon, 30 Aug 2004 14:27:49 -0400 User-Agent: KMail/1.6.2 References: <200408271516.i7RFGO8L061926@repoman.freebsd.org> <20040827202133.GC55748@hub.freebsd.org> <200408272253.14317.max@love2party.net> In-Reply-To: <200408272253.14317.max@love2party.net> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200408301427.49729.jhb@FreeBSD.org> X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on server.baldwin.cx cc: cvs-src@FreeBSD.org cc: Darren Reed cc: Andre Oppermann cc: cvs-all@FreeBSD.org cc: src-committers@FreeBSD.org Subject: Re: cvs commit: src/share/man/man4 ipfirewall.4 src/share/man/man9 pfil.9 src/sys/alpha/conf GENERIC src/sys/amd64/conf GENERIC src/sys/conf NOTES files options src/sys/i386/conf GENERIC src/sys/ia64/conf GENERIC SKI src/sys/modules/bridge Makefile ... X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Aug 2004 20:58:07 -0000 On Friday 27 August 2004 04:52 pm, Max Laier wrote: > Take a look at how sx(9) is implemented. What is there in pfil now is not > very different. Long story short sx(9) has even more overhead and has > starvation problems. It also has WITNESS checking whereas home rolled locks don't and can more easily lead to buggy code with deadlocks. sx(9) is just a mutex with a couple of cv's. Note that cv's have no additional overhead compared to msleep, in fact since their wait functions are more specific they may be slightly quicker for the cases that you aren't doing a timeout or a signal catch. > > The strategy currently in place is more akin to something that would > > be used in a device driver where you have two "halves" and one will > > sleep. In none of the code wrapped by PFIL_WLOCK is there anything > > that will make the system wait. > > You cannot sleep with PFIL_WLOCK held. It's a plain mutex lock! > > > The use of sx(9) should be a no-brainer. > > Yes, but it will reduce performance and introduce stravation problems. Once > we have a better sx(9) implementation I am all for switching over. Right > now it does not work. What starvation problems? A shared unlock gives precedence to waiting writers and an exclusive unlock gives precedence to waiting readers. This is very similar to rwlocks in Solaris with the exception that the sx code currently doesn't take priority into account when making this decision. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org