proc: clear pid bitmap entry after dropping proctree lock

There is no correctness change here, but the procid lock is contended in
the fork path and taking it while holding proctree avoidably extends its
hold time.

Note that there are other ids which can end up getting cleared with the
lock.

Sponsored by:	The FreeBSD Foundation
This commit is contained in:
mjg 2019-09-02 12:46:43 +00:00
parent 2d401b2b01
commit ad39028102

View File

@ -906,7 +906,6 @@ proc_reap(struct thread *td, struct proc *p, int *status, int options)
LIST_REMOVE(p, p_sibling);
reaper_abandon_children(p, true);
reaper_clear(p);
proc_id_clear(PROC_ID_PID, p->p_pid);
PROC_LOCK(p);
proc_clear_orphan(p);
PROC_UNLOCK(p);
@ -915,6 +914,8 @@ proc_reap(struct thread *td, struct proc *p, int *status, int options)
procdesc_reap(p);
sx_xunlock(&proctree_lock);
proc_id_clear(PROC_ID_PID, p->p_pid);
PROC_LOCK(p);
knlist_detach(p->p_klist);
p->p_klist = NULL;