proc: shave a lock trip on exit if possible

... which happens to be vast majority of the time
This commit is contained in:
Mateusz Guzik 2023-03-29 08:45:46 +00:00
parent 7c31de1a3c
commit 80cf427b8d

View File

@ -477,9 +477,11 @@ exit1(struct thread *td, int rval, int signo)
sx_xunlock(&allproc_lock);
sx_xlock(&proctree_lock);
PROC_LOCK(p);
p->p_flag &= ~(P_TRACED | P_PPWAIT | P_PPTRACE);
PROC_UNLOCK(p);
if ((p->p_flag & (P_TRACED | P_PPWAIT | P_PPTRACE)) != 0) {
PROC_LOCK(p);
p->p_flag &= ~(P_TRACED | P_PPWAIT | P_PPTRACE);
PROC_UNLOCK(p);
}
/*
* killjobc() might drop and re-acquire proctree_lock to