Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 09 Oct 2010 20:15:03 +0800
From:      David Xu <davidxu@freebsd.org>
To:        Robert Watson <rwatson@FreeBSD.org>
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
Message-ID:  <4CB05CC7.6050901@freebsd.org>
In-Reply-To: <alpine.BSF.2.00.1010091256390.1232@fledge.watson.org>
References:  <201010090250.o992oNw0022369@svn.freebsd.org> <alpine.BSF.2.00.1010091256390.1232@fledge.watson.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4CB05CC7.6050901>