svn commit: r213642 - in head/sys: kern sys

David Xu davidxu at
Sat Oct 9 12:15:22 UTC 2010

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:

run it with following command:
/usr/bin/time ./sigperf 150 20000

result before the  change:
after the change:

More information about the svn-src-head mailing list