From owner-freebsd-net@FreeBSD.ORG Sat Nov 24 19:19:26 2007 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 860DA16A41A; Sat, 24 Nov 2007 19:19:26 +0000 (UTC) (envelope-from kris@FreeBSD.org) Received: from weak.local (pointyhat.freebsd.org [IPv6:2001:4f8:fff6::2b]) by mx1.freebsd.org (Postfix) with ESMTP id 7F90A13C4E1; Sat, 24 Nov 2007 19:19:25 +0000 (UTC) (envelope-from kris@FreeBSD.org) Message-ID: <47487946.2010202@FreeBSD.org> Date: Sat, 24 Nov 2007 20:19:34 +0100 From: Kris Kennaway User-Agent: Thunderbird 2.0.0.9 (Macintosh/20071031) MIME-Version: 1.0 To: Max Laier References: <200711231232.04447.max@love2party.net> <20071123132453.W98338@fledge.watson.org> <200711242006.04753.max@love2party.net> In-Reply-To: <200711242006.04753.max@love2party.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-net@freebsd.org, freebsd-current@freebsd.org, Robert Watson Subject: Re: Switch pfil(9) to rmlocks X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Nov 2007 19:19:26 -0000 Max Laier wrote: > On Friday 23 November 2007, Robert Watson wrote: >> On Fri, 23 Nov 2007, Max Laier wrote: >>> attached is a diff to switch the pfil(9) subsystem to rmlocks, which >>> are more suited for the task. I'd like some exposure before doing >>> the switch, but I don't expect any fallout. This email is going >>> through the patched pfil already - twice. >> Max, >> >> Have you done performance measurements that show rmlocks to be a win in >> this scenario? I did some patchs for UNIX domain sockets to replace >> the rwlock there but it appeared not to have a measurable impact on SQL >> benchmarks, presumbaly because the read/write blend wasn't right and/or >> that wasnt a significant source of overhead in the benchmark. I'd >> anticipate a much more measurable improvement for pfil, but would be >> interested in learning how much is seen? > > I had to roll an artificial benchmark in order to see a significant change > (attached - it's a hack!). > > Using 3 threads on a 4 CPU machine I get the following results: > null hook: ~13% +/- 2 > mtx hook: up to 40% [*] > rw hook: ~5% +/- 1 > rm hook: ~35% +/- 5 > > [*] The mtx hook is inconclusive as my measurements vary a lot. If one > thread gets lucky and keeps running the overall time obviously goes down > by a magnitude. It seems however, that rmlocks greatly increase the > chance of that happening - not sure if that's a good thing, though. If > all threads receive approximately equal runtime (which is almost always > the case for rwlocks) the difference is somewhere around 10%. Is that something we can try to arrange to happen for improved performance in more general situations? Kris