Author: mjg
Date: Sat Dec  8 06:31:43 2018
New Revision: 341721
URL: https://svnweb.freebsd.org/changeset/base/341721

Log:
  proc: handle sdt exit probe before taking the proc lock
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/kern/kern_exit.c

Modified: head/sys/kern/kern_exit.c
==============================================================================
--- head/sys/kern/kern_exit.c   Sat Dec  8 06:30:41 2018        (r341720)
+++ head/sys/kern/kern_exit.c   Sat Dec  8 06:31:43 2018        (r341721)
@@ -556,6 +556,17 @@ exit1(struct thread *td, int rval, int signo)
                PROC_UNLOCK(q);
        }
 
+#ifdef KDTRACE_HOOKS
+       if (SDT_PROBES_ENABLED()) {
+               int reason = CLD_EXITED;
+               if (WCOREDUMP(signo))
+                       reason = CLD_DUMPED;
+               else if (WIFSIGNALED(signo))
+                       reason = CLD_KILLED;
+               SDT_PROBE1(proc, , , exit, reason);
+       }
+#endif
+
        /* Save exit status. */
        PROC_LOCK(p);
        p->p_xthread = td;
@@ -573,15 +584,6 @@ exit1(struct thread *td, int rval, int signo)
         * Notify interested parties of our demise.
         */
        KNOTE_LOCKED(p->p_klist, NOTE_EXIT);
-
-#ifdef KDTRACE_HOOKS
-       int reason = CLD_EXITED;
-       if (WCOREDUMP(signo))
-               reason = CLD_DUMPED;
-       else if (WIFSIGNALED(signo))
-               reason = CLD_KILLED;
-       SDT_PROBE1(proc, , , exit, reason);
-#endif
 
        /*
         * If this is a process with a descriptor, we may not need to deliver
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to