From owner-freebsd-net@FreeBSD.ORG Sun Nov 25 12:07:10 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 974A116A417; Sun, 25 Nov 2007 12:07:10 +0000 (UTC) (envelope-from darrenr@freebsd.org) Received: from out1.smtp.messagingengine.com (out1.smtp.messagingengine.com [66.111.4.25]) by mx1.freebsd.org (Postfix) with ESMTP id 6ABA913C457; Sun, 25 Nov 2007 12:07:10 +0000 (UTC) (envelope-from darrenr@freebsd.org) Received: from compute2.internal (compute2.internal [10.202.2.42]) by out1.messagingengine.com (Postfix) with ESMTP id 1D1DC54302; Sun, 25 Nov 2007 07:07:10 -0500 (EST) Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by compute2.internal (MEProxy); Sun, 25 Nov 2007 07:07:10 -0500 X-Sasl-enc: qxXW6/3x0/kWlFI0Z3r2+jHvdVZ2Uwc0fn7xoJrLjuYr 1195992429 Received: from [192.168.1.235] (64-142-85-108.dsl.dynamic.sonic.net [64.142.85.108]) by mail.messagingengine.com (Postfix) with ESMTP id 2C28818CD9; Sun, 25 Nov 2007 07:07:09 -0500 (EST) Message-ID: <474964CF.90308@freebsd.org> Date: Sun, 25 Nov 2007 04:04:31 -0800 From: Darren Reed User-Agent: Thunderbird 2.0.0.0 (Windows/20070326) MIME-Version: 1.0 To: Max Laier References: <200711231232.04447.max@love2party.net> <200711242006.04753.max@love2party.net> <47491532.1050600@freebsd.org> <200711251047.44778.max@love2party.net> In-Reply-To: <200711251047.44778.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: Sun, 25 Nov 2007 12:07:10 -0000 Max Laier wrote: > On Sunday 25 November 2007, Darren Reed wrote: > > 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 > > > > Is that 13%/5%/35% faster or slower or improvement or degradation? > > If "rw hook" (using rwlock like we have today?) is 5%, whas is the > > baseline? > > > > I'm expecting that at least one of these should be a 0%... > > Sorry for the sparse explanation. All numbers above are gain with rmlocks > i.e. rmlocks are faster in all scenarios. The test cases are different > hook functions. Every hook has a DELAY(1) and a lock/unlock call around > it of the respective lock type. read lock acquisitions for rw and rm. > Please look at the code I posted a bit later for more details. > Thanks for the clarification. That makes rmlocks very interesting. And the kind of lock that both ipf and ipfw could benefit from, especially since you're planning on changing the pfil locks to be this way. Are you (or is someone else?) intending on following up moving ipfw to them, where appropriate? I'm tempted to suggest them to other platforms...although I'd expect some amount nay-saying because of NIH, it would be good if others also picked up on them, if the benefits are this clear cut... Darren