From owner-svn-src-all@FreeBSD.ORG Wed Nov 30 21:32:29 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8F7441065673; Wed, 30 Nov 2011 21:32:29 +0000 (UTC) (envelope-from giovanni.trematerra@gmail.com) Received: from mail-qw0-f47.google.com (mail-qw0-f47.google.com [209.85.216.47]) by mx1.freebsd.org (Postfix) with ESMTP id 122648FC0C; Wed, 30 Nov 2011 21:32:28 +0000 (UTC) Received: by qaea17 with SMTP id a17so4043824qae.13 for ; Wed, 30 Nov 2011 13:32:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=0JNHAVmCM1gQv6tYePdn88W0YgyODKK1EasOL7f7L+U=; b=JqDgp0YfQnWm6pxaGOVt9uQ97kR4pPXfIM8vAfRzInQWIqizf7Cs+i24eC7wGTF5zD BvO+VF7v2Hh5G5UBtwPmpIoIdP7jURACLvkX9m89bTz3UTBDO9E7OQFgUevXR0ixXjoF KD6PSMpo88mvl2xHZ52CB5JiFgf9lfw8LMM98= MIME-Version: 1.0 Received: by 10.229.66.152 with SMTP id n24mr646294qci.218.1322686872222; Wed, 30 Nov 2011 13:01:12 -0800 (PST) Sender: giovanni.trematerra@gmail.com Received: by 10.229.13.6 with HTTP; Wed, 30 Nov 2011 13:01:12 -0800 (PST) In-Reply-To: <201110051656.p95Gu6Cw020744@svn.freebsd.org> References: <201110051656.p95Gu6Cw020744@svn.freebsd.org> Date: Wed, 30 Nov 2011 22:01:12 +0100 X-Google-Sender-Auth: 5LumlJGl0nsEtYfZSCTc7od8SyY Message-ID: From: Giovanni Trematerra To: Konstantin Belousov Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: src-committers@freebsd.org, peterjeremy@acm.org, John Baldwin , svn-src-all@freebsd.org, Attilio Rao , svn-src-head@freebsd.org, Jeff Roberson Subject: Re: svn commit: r226042 - in head/sys: kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Nov 2011 21:32:29 -0000 On Wed, Oct 5, 2011 at 6:56 PM, Konstantin Belousov wrote= : > Author: kib > Date: Wed Oct =A05 16:56:06 2011 > New Revision: 226042 > URL: http://svn.freebsd.org/changeset/base/226042 > > Log: > =A0Supply unique (st_dev, st_ino) value pair for the fstat(2) done on the= pipes. > > =A0Reviewed by: =A0jhb, Peter Jeremy > =A0MFC after: =A0 =A02 weeks > > Modified: > =A0head/sys/kern/sys_pipe.c > =A0head/sys/sys/pipe.h > Hi Konstantin, unfortunately your commit introduces a performance penalty of about 3% documented below in a real workload. I guess that fstat(2) on the pipes is seldom used so we could just be lazy and alloc a new unr number inside pipe_stat instead of during pipe creation= . In that case if an application doesn't need fstat(2) on the pipes it won't be charged the cost of alloc_unr/free_unr for the fake inode number. The patch I propose, furthermore, fix a panic in the case alloc_unr failed to allocate a new unr number and return -1. This is because ino_t is unsigned and the t= est pipe_ino > 0 into pipeclose would be true, calling then free_unr when it hasn't to. The proposed patch was tested with a regression test code that you can find= here http://www.trematerra.net/patches/pipe-fstat.c Feel free to add it under tools/regression/pipe/ Here the proposed patch: http://www.trematerra.net/patches/lazy_inoalloc.diff Here the report of the benchmark: Configuration 10.0-CURRENT updated to r22807. kern.smp.disabled=3D1 in /boot/loader.conf kernel config GENERIC without debugging options. The first result of any test was discarded and not reported here. here the result of three executions of # make -s buildkernel note that I managed to compile the same identical source files for all the tests. r22807 with r226042 reverted (time in seconds) 527, 527, 527 r22807 (time in seconds) 544, 544, 544 r22807M with the proposed patch (time in seconds) 527, 528, 528 ministat output: x r22807 with r226042 reverted + r22807 * r22807M with the proposed patch +--------------------------------------------------------------------------= ----+ |+ * = x| |* * = x| ||__A_M| = A| +--------------------------------------------------------------------------= ----+ N Min Max Median Avg Stddev x 3 544 544 544 544 0 + 3 527 527 527 527 0 Difference at 95.0% confidence -17 +/- 0 -3.125% +/- 0% (Student's t, pooled s =3D 0) * 3 527 528 528 527.66667 0.57735027 Difference at 95.0% confidence -16.3333 +/- 0.925333 -3.00245% +/- 0.170098% (Student's t, pooled s =3D 0.408248) -- Gianni