cvs commit: src/sys/kern imgact_elf.c kern_fork.c kern_kse.c
kern_thr.c kern_thread.c src/sys/sys proc.h
Marcel Moolenaar
marcel at FreeBSD.org
Sat Jun 26 11:59:09 PDT 2004
marcel 2004-06-26 18:58:22 UTC
FreeBSD src repository
Modified files:
sys/kern imgact_elf.c kern_fork.c kern_kse.c
kern_thr.c kern_thread.c
sys/sys proc.h
Log:
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.
Revision Changes Path
1.152 +31 -33 src/sys/kern/imgact_elf.c
1.227 +0 -1 src/sys/kern/kern_fork.c
1.182 +1 -3 src/sys/kern/kern_kse.c
1.20 +0 -1 src/sys/kern/kern_thr.c
1.185 +57 -71 src/sys/kern/kern_thread.c
1.382 +0 -1 src/sys/sys/proc.h
More information about the cvs-src
mailing list