summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_thr.c
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2004-06-26 18:58:22 +0000
committermarcel <marcel@FreeBSD.org>2004-06-26 18:58:22 +0000
commit49e32d12eb7f48f207cced3b3b9ddca3db9c8599 (patch)
treed1f4df66d3b6d969d902dea324d27e79bb59825f /sys/kern/kern_thr.c
parentf342eda242a30dffe707490497ce17b212233cd1 (diff)
downloadFreeBSD-src-49e32d12eb7f48f207cced3b3b9ddca3db9c8599.zip
FreeBSD-src-49e32d12eb7f48f207cced3b3b9ddca3db9c8599.tar.gz
Allocate TIDs in thread_init() and deallocate them in thread_fini().
The overhead of unconditionally allocating TIDs (and likewise, unconditionally deallocating them), is amortized across multiple thread creations by the way UMA makes it possible to have type-stable storage. Previously the cost was kept down by having threads created as part of a fork operation use the process' PID as the TID. While this had some nice properties, it also introduced complexity in the way TIDs were allocated. Most importantly, by using the type-stable storage that UMA gives us this was also unnecessary. This change affects how core dumps are created and in particular how the PRSTATUS notes are dumped. Since we don't have a thread with a TID equalling the PID, we now need a different way to preserve the old and previous behavior. We do this by having the given thread (i.e. the thread passed to the core dump code in td) dump it's state first and fill in pr_pid with the actual PID. All other threads will have pr_pid contain their TIDs. The upshot of all this is that the debugger will now likely select the right LWP (=TID) as the initial thread. Credits to: julian@ for spotting how we can utilize UMA. Thanks to: all who provided julian@ with test results.
Diffstat (limited to 'sys/kern/kern_thr.c')
-rw-r--r--sys/kern/kern_thr.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/sys/kern/kern_thr.c b/sys/kern/kern_thr.c
index 4d1182b..50fed6e 100644
--- a/sys/kern/kern_thr.c
+++ b/sys/kern/kern_thr.c
@@ -130,7 +130,6 @@ thr_create(struct thread *td, struct thr_create_args *uap)
/* Initialize our td. */
td0 = thread_alloc();
- td0->td_tid = thread_new_tid();
/*
* Try the copyout as soon as we allocate the td so we don't have to
OpenPOWER on IntegriCloud