From owner-freebsd-arch@FreeBSD.ORG Mon Jul 21 20:56:12 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 BBDFF106566B; Mon, 21 Jul 2008 20:56:12 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 31B068FC15; Mon, 21 Jul 2008 20:56:12 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [IPv6:::1]) (authenticated bits=0) by server.baldwin.cx (8.14.2/8.14.2) with ESMTP id m6LKtZI8084378; Mon, 21 Jul 2008 16:56:06 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: Jeff Roberson Date: Mon, 21 Jul 2008 11:41:09 -0400 User-Agent: KMail/1.9.7 References: <20080718163231.B954@desktop> In-Reply-To: <20080718163231.B954@desktop> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200807211141.09387.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [IPv6:::1]); Mon, 21 Jul 2008 16:56:06 -0400 (EDT) X-Virus-Scanned: ClamAV 0.93.1/7770/Mon Jul 21 15:30:47 2008 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.3 required=4.2 tests=AWL,BAYES_00, DATE_IN_PAST_03_06,NO_RELAYS autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: attilio@freebsd.org, 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: Mon, 21 Jul 2008 20:56:12 -0000 On Friday 18 July 2008 10:41:58 pm Jeff Roberson wrote: > 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. Woo! Thanks for polishing this. > 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. Originally, the idea was that if one had a LOR bug in a driver, one could kldunload the driver and have WITNESS forget about any orders for the driver's lock, fix the bug, and try again, but the short-lived names problem is much more common in practice, and trying to remove info about a specific lock class from the graph is a bit tenuous, so I think this is the better approach going forward. > 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(). Neat. > I'm mostly interested in hearing what people have to say about the space > bloat. I believe it is in a commit ready state. I think the space usage is perfectly fine. Also, now that you malloc the actual witness objects instead of putting them in the BSS (something that should have been done anyway I think), I would make the number of witness objects a loader tunable. -- John Baldwin