From 55194e796cd9e8eb27d9bb4ec9f07184e390d01a Mon Sep 17 00:00:00 2001 From: davidxu Date: Sat, 9 Oct 2010 02:50:23 +0000 Subject: 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 --- sys/kern/kern_exit.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sys/kern/kern_exit.c') 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. -- cgit v1.1