From owner-freebsd-arch@FreeBSD.ORG Tue Aug 5 14:52:58 2008 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 04EB9106568A for ; Tue, 5 Aug 2008 14:52:58 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.157]) by mx1.freebsd.org (Postfix) with ESMTP id 095398FC1C for ; Tue, 5 Aug 2008 14:52:56 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: by fg-out-1718.google.com with SMTP id l26so3442330fgb.35 for ; Tue, 05 Aug 2008 07:52:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references :x-google-sender-auth; bh=UDLhpwt/PbU+zqcaW3d2G2EGwJL2GHGGrwMNmHqT0Vw=; b=MaPnTTwpQ5gnJKj+gYqa/lMa0H72h6HMZIT5vY8Vv1COlKEfuw0bxvk6jIIL1ZvPEr ef5NNPGWLAJ7NhlJIxALnVxMxAT4dA6nNZfV/L+qp5FvAgA/P8VaS9PS/+4P0ORFnxDJ jftmYozRj8yILA54agZMbNbW3VXpiQFM01VHw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references:x-google-sender-auth; b=UOV4Aut+EPg4It84AUHoUShKMD0xTQMIVOQgrAgWd/gMB4NnQoqrH0nLSoyCwClAZv JGn9N5zafO/JFUWjxXKPZ8cn4DRtgOYFxNXeUDAvGyLvEaLGjfPS4DUBRaragRuH4D8p XU3bQzq+h3NTESLF237iP5yWiA9LLdWNCbqmg= Received: by 10.86.95.20 with SMTP id s20mr11738278fgb.65.1217947975367; Tue, 05 Aug 2008 07:52:55 -0700 (PDT) Received: by 10.86.78.14 with HTTP; Tue, 5 Aug 2008 07:52:55 -0700 (PDT) Message-ID: <3bbf2fe10808050752ra9bf259x45627660245d3ad9@mail.gmail.com> Date: Tue, 5 Aug 2008 16:52:55 +0200 From: "Attilio Rao" Sender: asmrookie@gmail.com To: "Jeff Roberson" In-Reply-To: <20080718163231.B954@desktop> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20080718163231.B954@desktop> X-Google-Sender-Auth: c961740b98a5b2e8 Cc: arch@freebsd.org, ivmaykov@gmail.com Subject: Re: witness performance improvements 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, 05 Aug 2008 14:52:58 -0000 2008/7/19, Jeff Roberson : > Hello, > > I have a patch that improves witness performance available at: > > http://people.freebsd.org/~jeff/witness.diff > > This improvement comes at the cost of some significant space overhead. It > changes the witness graph from a linked tree to a matrix based approach. > Relationships can be quickly resolved with a table lookup. The table size > is WITNESS_COUNT^2, or 1MB with the current count of 1024. > > This patch also makes struct witness objects persistent even after the last > lock using this name has been removed. This is helpful for short lived > objects which may be created frequently. > > To reduce lock contention on SMP witness_checkorder() now runs without the > w_mtx when there are no lock violations. I also cache a lock_list_entry in > each thread as allocating these requires the w_mtx. The entry is disposed > of at thread_exit(). > > There is also a new sysctl that produces dot output which graphs lock order > relationships with the graphviz program. > > Most of this work was done by Ilya Maykov while he was at Isilon systems. > The locking work and some cleanup/porting/refinement was done by me on > behalf of Nokia. > > The performance improvement can be significant. It is only on the order of > 10-20% for buildkernel but on a packet forwarding test at nokia it sped > things up by 5x putting a witness enabled kernel within about 50% of the > performance of a kernel without. I believe buildworld isn't helped as much > because forking and exiting a lot would then contend on the witness lock. Hello, here there is a fixed version of the Jeff's patch: http://community.gufi.org/~rookie/witness_fast.diff It fixes some bugs, imports the "comma serparated" approach for fullgraph and drops the cyclegraph (which can be now evicted by the fullgraph through handy scripts). I'd like people test this "final" version before it hits the tree and give feedbacks. Thanks, Attilio PS: consider this patch not exactly to be set as an example in regard of "diff reduction against head" :) -- Peace can only be achieved by understanding - A. Einstein