From owner-freebsd-arch@FreeBSD.ORG Tue Feb 7 22:16:17 2012 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D2D61106566B; Tue, 7 Feb 2012 22:16:17 +0000 (UTC) (envelope-from giovanni.trematerra@gmail.com) Received: from mail-qy0-f182.google.com (mail-qy0-f182.google.com [209.85.216.182]) by mx1.freebsd.org (Postfix) with ESMTP id D2CAC8FC15; Tue, 7 Feb 2012 22:16:16 +0000 (UTC) Received: by qcmt40 with SMTP id t40so6039370qcm.13 for ; Tue, 07 Feb 2012 14:16:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type; bh=FFPCWrIaj0YRxC1BRifQ7l0AkpOyjxuTDc2yKTaqUzo=; b=wWNCvAs0LG4fW8PTmrlAeKh1MbVB0K8JkaJJJciBUrt6aMkiIb3QfntedhK+donCCD /wfFiP+LdimZrDU5gKcBcRqM48W+2huZrabemo6y/Ea1OumXm3bF/oYqVoI4rNED3U1g Kcb8Pu6cSM9TUmXyfbBJ1NVlCdhzus3Z6Ph9Y= MIME-Version: 1.0 Received: by 10.224.95.196 with SMTP id e4mr3376446qan.63.1328652975939; Tue, 07 Feb 2012 14:16:15 -0800 (PST) Sender: giovanni.trematerra@gmail.com Received: by 10.229.81.200 with HTTP; Tue, 7 Feb 2012 14:16:15 -0800 (PST) Date: Tue, 7 Feb 2012 23:16:15 +0100 X-Google-Sender-Auth: xDlBgRLJUCOckRZDgSJUsU5828A Message-ID: From: Giovanni Trematerra To: freebsd-arch@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Cc: flo@freebsd.org, Kip Macy , Attilio Rao , Konstantin Belousov , bde@freebsd.org, jilles@freebsd.org Subject: [LAST ROUND] fifo/pipe merge code X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Feb 2012 22:16:18 -0000 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