Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Sep 2019 12:46:43 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r351697 - head/sys/kern
Message-ID:  <201909021246.x82Ckhah035653@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201909021246.x82Ckhah035653>