svn commit: r351697 - head/sys/kern

Mateusz Guzik mjg at FreeBSD.org
Mon Sep 2 12:46:44 UTC 2019


Author: mjg
Date: Mon Sep  2 12:46:43 2019
New Revision: 351697
URL: https://svnweb.freebsd.org/changeset/base/351697

Log:
  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

Modified:
  head/sys/kern/kern_exit.c

Modified: head/sys/kern/kern_exit.c
==============================================================================
--- head/sys/kern/kern_exit.c	Mon Sep  2 11:04:17 2019	(r351696)
+++ head/sys/kern/kern_exit.c	Mon Sep  2 12:46:43 2019	(r351697)
@@ -906,7 +906,6 @@ proc_reap(struct thread *td, struct proc *p, int *stat
 	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);
@@ -914,6 +913,8 @@ proc_reap(struct thread *td, struct proc *p, int *stat
 	if (p->p_procdesc != NULL)
 		procdesc_reap(p);
 	sx_xunlock(&proctree_lock);
+
+	proc_id_clear(PROC_ID_PID, p->p_pid);
 
 	PROC_LOCK(p);
 	knlist_detach(p->p_klist);


More information about the svn-src-head mailing list