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

David Xu davidxu at freebsd.org
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:
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



More information about the svn-src-all mailing list