Date: Tue, 7 Feb 2012 23:16:15 +0100 From: Giovanni Trematerra <gianni@freebsd.org> To: freebsd-arch@freebsd.org Cc: flo@freebsd.org, Kip Macy <kmacy@freebsd.org>, Attilio Rao <attilio@freebsd.org>, Konstantin Belousov <kib@freebsd.org>, bde@freebsd.org, jilles@freebsd.org Subject: [LAST ROUND] fifo/pipe merge code Message-ID: <CACfq090%2BEDVjj_rRNyafiod_BBzGUzmQ9CjApZLcXWR-Ax=0uQ@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
Hi All, Here a commit candidate patch of the experimental one posted on Jan 8 http://www.trematerra.net/patches/pipefifo_merge.4.3.patch The patch aims to - not introduce any performance regressions in pipe code - speed up performance for fifos - not introduce any regressions - fifos and pipes have to have the same behavior as before the patch. - share as much code as possible between pipes and fifos. The patch is greatly improved from its first experimental form. Now it's more clean and compact and integrates all the good suggestions from previous reviewers. Here some of the major differences: - no more different UMA zones to allocate things. - no more pipeinfo structure. - fix a bug at fifo_close. - fix a different behavior for fifos during truncate (thanks to jilles). The patch was reviewed in a previous form by jhb@, bde@, jilles@, attilio@(only style bug) This version of the patch was reviewed privately by jilles@, attilio@(only style bug) TEST ================================ the patch passes all the regression tests in tools/regression/fifo tools/regression/pipe tools/regression/poll /* same behavior as a stock kernel */ tools/regression/bin/sh /* same behavior as a stock kernel */ pho@ stress tested the patch for 19 hours without any fatal error or panic. BENCHMARK ================================= PIPE the benchmark was performed by compiling a GENERIC kernel. There's a lot of pipe code involving during a compilation. Such a test was used to discovery a performance regression in r226042. x build_stock.txt + build_patched.txt +------------------------------------------------------------------------------+ | + * x +| ||____________________________M_|_____A_______A_______M_____|______________| | +------------------------------------------------------------------------------+ N Min Max Median Avg Stddev x 3 350 351 351 350.66667 0.57735027 + 3 349 352 350 350.33333 1.5275252 No difference proven at 95.0% confidence So no performance regression at all into pipes code. FIFO To benchmark fifo it was sent 1000 chunks of different size through a fifo. (128, 512, 4096 bytes) x fifo_stock_128.txt + fifo_patched_128.txt +------------------------------------------------------------------------------+ | + | | + + x x x| ||M_A___| |________M__A____________| | +------------------------------------------------------------------------------+ N Min Max Median Avg Stddev x 3 835 839 836 836.66667 2.081666 + 3 826 827 826 826.33333 0.57735027 Difference at 95.0% confidence -10.3333 +/- 3.46228 -1.23506% +/- 0.413818% (Student's t, pooled s = 1.52753) x fifo_stock_512.txt + fifo_patched_512.txt +------------------------------------------------------------------------------+ |+++ xx| ||A| A|| +------------------------------------------------------------------------------+ N Min Max Median Avg Stddev x 3 1667 1671 1669 1669 2 + 3 1413 1419 1415 1415.6667 3.0550505 Difference at 95.0% confidence -253.333 +/- 5.85232 -15.1787% +/- 0.350648% (Student's t, pooled s = 2.58199) x fifo_stock_4096.txt + fifo_patched_4096.txt +------------------------------------------------------------------------------+ |+ | |+ x | |+ x x| |A |__M____A_______| | +------------------------------------------------------------------------------+ N Min Max Median Avg Stddev x 3 43682 45237 43694 44204.333 894.33569 + 3 36571 36606 36600 36592.333 18.717194 Difference at 95.0% confidence -7612 +/- 1433.69 -17.22% +/- 3.24332% (Student's t, pooled s = 632.529) if someone would like to reproduce the test can download a copy of the sources a http://www.trematerra.net/patches/fifoperf/ the code is from zhaoshuai@. Makefile, builds benchmark.c benchmark.c set up a fifo, fork and send a number of messages of a size depending from the input parameters. runme.sh run the test launching benchmark binary to send different number of messages of different sizes. Note that when the chunk is small there isn't so much difference with the patch but no regression in any case, when the chunk gets bigger there is a performance boost. Many thanks to all the people that spent their time to review the patch A special thanks to pho@ to have wasted his time testing the patch in its various forms. Reviews and possibly merge into the tree are welcomed. -- Gianni
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACfq090%2BEDVjj_rRNyafiod_BBzGUzmQ9CjApZLcXWR-Ax=0uQ>