proc: handle sdt exit probe before taking the proc lock

Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Mateusz Guzik 2018-12-08 06:31:43 +00:00
parent 13a45e4b14
commit eadb1dcb71

View File

@ -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;
@ -574,15 +585,6 @@ exit1(struct thread *td, int rval, int signo)
*/
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
* a signal to the parent. proctree_lock is held over