cvs commit: src/sys/kern kern_exit.c kern_ktrace.c
John Baldwin
jhb at FreeBSD.org
Wed Jun 13 20:01:43 UTC 2007
jhb 2007-06-13 20:01:42 UTC
FreeBSD src repository
Modified files:
sys/kern kern_exit.c kern_ktrace.c
Log:
Improve the ktrace locking somewhat to reduce overhead:
- Depessimize userret() in kernels where KTRACE is enabled by doing an
unlocked check of the per-process queue of pending events before
acquiring any locks. Previously ktr_userret() unconditionally acquired
the global ktrace_sx lock on every return to userland for every thread,
even if ktrace wasn't enabled for the thread.
- Optimize the locking in exit() to first perform an unlocked read of
p_traceflag to see if ktrace is enabled and only acquire locks and
teardown ktrace if the test succeeds. Also, explicitly disable tracing
before draining any pending events so the pending events actually get
written out. The unlocked read is safe because proc lock is acquired
earlier after single-threading so p_traceflag can't change between then
and this check (well, it can currently due to a bug in ktrace I will fix
next, but that race existed prior to this change as well).
Reviewed by: rwatson
Revision Changes Path
1.304 +24 -18 src/sys/kern/kern_exit.c
1.120 +2 -0 src/sys/kern/kern_ktrace.c
More information about the cvs-all
mailing list