Date: Sat, 31 Dec 2016 12:49:20 +0000 (UTC) From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310965 - stable/11/sys/kern Message-ID: <201612311249.uBVCnKTd084451@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mjg Date: Sat Dec 31 12:49:20 2016 New Revision: 310965 URL: https://svnweb.freebsd.org/changeset/base/310965 Log: MFC r303921: ktrace: do a lockless check on fork to see if tracing is enabled This saves 2 lock acquisitions in the common case. Modified: stable/11/sys/kern/kern_ktrace.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_ktrace.c ============================================================================== --- stable/11/sys/kern/kern_ktrace.c Sat Dec 31 12:47:41 2016 (r310964) +++ stable/11/sys/kern/kern_ktrace.c Sat Dec 31 12:49:20 2016 (r310965) @@ -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) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201612311249.uBVCnKTd084451>