proc: when exiting move to zombproc before taking proctree

The kernel was already doing this prior to r329615. It was changed
to reduce contention on allproc. However, introduction of pidhash
locks and removal of proctree -> allproc ordering from fork thanks
to bitmaps fixed things enough to make this change pessimal.

waitpid takes proctree on each call and this change (now) causes
avoidable stalls if allproc is held.

Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Mateusz Guzik 2018-12-07 12:32:25 +00:00
parent 34ebdceac0
commit b1fbffe73c

View File

@ -448,7 +448,6 @@ exit1(struct thread *td, int rval, int signo)
WITNESS_WARN(WARN_PANIC, NULL, "process (pid %d) exiting", p->p_pid);
sx_xlock(&proctree_lock);
/*
* Move proc from allproc queue to zombproc.
*/
@ -459,6 +458,8 @@ exit1(struct thread *td, int rval, int signo)
sx_xunlock(&zombproc_lock);
sx_xunlock(&allproc_lock);
sx_xlock(&proctree_lock);
/*
* Reparent all children processes:
* - traced ones to the original parent (or init if we are that parent)