svn commit: r303922 - head/sys/kern
Mateusz Guzik
mjg at FreeBSD.org
Wed Aug 10 15:25:46 UTC 2016
Author: mjg
Date: Wed Aug 10 15:25:44 2016
New Revision: 303922
URL: https://svnweb.freebsd.org/changeset/base/303922
Log:
ktrace: do a lockless check on fork to see if tracing is enabled
This saves 2 lock acquisitions in the common case.
Modified:
head/sys/kern/kern_ktrace.c
Modified: head/sys/kern/kern_ktrace.c
==============================================================================
--- head/sys/kern/kern_ktrace.c Wed Aug 10 15:24:15 2016 (r303921)
+++ head/sys/kern/kern_ktrace.c Wed Aug 10 15:25:44 2016 (r303922)
@@ -572,9 +572,14 @@ void
ktrprocfork(struct proc *p1, struct proc *p2)
{
+ MPASS(p2->p_tracevp == NULL);
+ MPASS(p2->p_traceflag == 0);
+
+ if (p1->p_traceflag == 0)
+ return;
+
PROC_LOCK(p1);
mtx_lock(&ktrace_mtx);
- KASSERT(p2->p_tracevp == NULL, ("new process has a ktrace vnode"));
if (p1->p_traceflag & KTRFAC_INHERIT) {
p2->p_traceflag = p1->p_traceflag;
if ((p2->p_tracevp = p1->p_tracevp) != NULL) {
More information about the svn-src-head
mailing list