diff options
author | davidxu <davidxu@FreeBSD.org> | 2010-10-09 02:50:23 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2010-10-09 02:50:23 +0000 |
commit | 55194e796cd9e8eb27d9bb4ec9f07184e390d01a (patch) | |
tree | 84ad0652e39fc58da6ca522cc6bf55a188109780 /sys/kern/kern_exit.c | |
parent | 6afff59f3c11c8f879672f8dbcb0a74bcbae79a5 (diff) | |
download | FreeBSD-src-55194e796cd9e8eb27d9bb4ec9f07184e390d01a.zip FreeBSD-src-55194e796cd9e8eb27d9bb4ec9f07184e390d01a.tar.gz |
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.
Earlier patch was reviewed by: jhb, julian
Diffstat (limited to 'sys/kern/kern_exit.c')
-rw-r--r-- | sys/kern/kern_exit.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 8358f75..029f1c3 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -403,6 +403,8 @@ exit1(struct thread *td, int rv) PROC_UNLOCK(p); lim_free(plim); + tidhash_remove(td); + /* * Remove proc from allproc queue and pidhash chain. * Place onto zombproc. Unlink from parent's child list. |