svn commit: r226042 - in head/sys: kern sys

Giovanni Trematerra gianni at freebsd.org
Wed Nov 30 21:32:29 UTC 2011


On Wed, Oct 5, 2011 at 6:56 PM, Konstantin Belousov <kib at freebsd.org> wrote:
> Author: kib
> Date: Wed Oct  5 16:56:06 2011
> New Revision: 226042
> URL: http://svn.freebsd.org/changeset/base/226042
>
> Log:
>  Supply unique (st_dev, st_ino) value pair for the fstat(2) done on the pipes.
>
>  Reviewed by:  jhb, Peter Jeremy <peterjeremy acm org>
>  MFC after:    2 weeks
>
> Modified:
>  head/sys/kern/sys_pipe.c
>  head/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 test
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=1 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 = 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 = 0.408248)

--
Gianni


More information about the svn-src-all mailing list