summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_fork.c
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2010-10-09 02:50:23 +0000
committerdavidxu <davidxu@FreeBSD.org>2010-10-09 02:50:23 +0000
commit55194e796cd9e8eb27d9bb4ec9f07184e390d01a (patch)
tree84ad0652e39fc58da6ca522cc6bf55a188109780 /sys/kern/kern_fork.c
parent6afff59f3c11c8f879672f8dbcb0a74bcbae79a5 (diff)
downloadFreeBSD-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_fork.c')
-rw-r--r--sys/kern/kern_fork.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index 81631f6..da2c415 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -456,7 +456,7 @@ again:
AUDIT_ARG_PID(p2->p_pid);
LIST_INSERT_HEAD(&allproc, p2, p_list);
LIST_INSERT_HEAD(PIDHASH(p2->p_pid), p2, p_hash);
-
+ tidhash_add(td2);
PROC_LOCK(p2);
PROC_LOCK(p1);
OpenPOWER on IntegriCloud