aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_kse.c
diff options
context:
space:
mode:
authorMarcel Moolenaar <marcel@FreeBSD.org>2004-06-26 18:58:22 +0000
committerMarcel Moolenaar <marcel@FreeBSD.org>2004-06-26 18:58:22 +0000
commit247aba2474592f3d49e2382b94cbe1e705d6f9b1 (patch)
treed1f4df66d3b6d969d902dea324d27e79bb59825f /sys/kern/kern_kse.c
parent3f9d1ef905eb87fabafac78f96a4dd99f269e0ef (diff)
downloadsrc-247aba2474592f3d49e2382b94cbe1e705d6f9b1.tar.gz
src-247aba2474592f3d49e2382b94cbe1e705d6f9b1.zip
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.
Notes
Notes: svn path=/head/; revision=131149
Diffstat (limited to 'sys/kern/kern_kse.c')
-rw-r--r--sys/kern/kern_kse.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/sys/kern/kern_kse.c b/sys/kern/kern_kse.c
index fea1c4671a78..349812714fdb 100644
--- a/sys/kern/kern_kse.c
+++ b/sys/kern/kern_kse.c
@@ -872,10 +872,8 @@ thread_alloc_spare(struct thread *td, struct thread *spare)
if (td->td_standin)
return;
- if (spare == NULL) {
+ if (spare == NULL)
spare = thread_alloc();
- spare->td_tid = thread_new_tid();
- }
td->td_standin = spare;
bzero(&spare->td_startzero,
(unsigned)RANGEOF(struct thread, td_startzero, td_endzero));