From owner-svn-src-all@FreeBSD.ORG Sat Oct 9 12:15:22 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from alona.my.domain (localhost [127.0.0.1]) by hub.freebsd.org (Postfix) with ESMTP id 97C99106564A; Sat, 9 Oct 2010 12:15:18 +0000 (UTC) (envelope-from davidxu@freebsd.org) Message-ID: <4CB05CC7.6050901@freebsd.org> Date: Sat, 09 Oct 2010 20:15:03 +0800 From: David Xu User-Agent: Thunderbird 2.0.0.21 (X11/20090522) MIME-Version: 1.0 To: Robert Watson References: <201010090250.o992oNw0022369@svn.freebsd.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r213642 - in head/sys: kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Oct 2010 12:15:22 -0000 Robert Watson wrote: > On Sat, 9 Oct 2010, David Xu wrote: > >> Create a global thread hash table to speed up thread lookup, use >> rwlock to protect the table. In old code, thread lookup is done with >> process lock held, to find a thread, kernel has to iterate through >> process and thread list, this is quite inefficient. >> With this change, test shows in extreme case performance is >> dramatically improved. > > Could you say a little more about which workloads this helps with? > Obviously, things that look up thread IDs, but since I'm less familiar > with the threading code, a hand-wave would give me useful intuitions! > > BTW, my experience with switching to read-write locking in the pcbinfo > hash lookup is that it made a huge difference, and that I experience > only fairly incremental performance changes on <= 8 cores by trying to > go to more refined models (such as encouraging CPU affinity for table > entries, etc). > > Robert > I have tested it with my simple benchmark program: http://people.freebsd.org/~davidxu/tidhash/sigperf.c run it with following command: /usr/bin/time ./sigperf 150 20000 result before the change: http://people.freebsd.org/~davidxu/tidhash/thread_find.txt after the change: http://people.freebsd.org/~davidxu/tidhash/tfind.txt