svn commit: r341685 - head/sys/kern

Mateusz Guzik mjg at FreeBSD.org
Fri Dec 7 12:32:27 UTC 2018


Author: mjg
Date: Fri Dec  7 12:32:25 2018
New Revision: 341685
URL: https://svnweb.freebsd.org/changeset/base/341685

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

Modified:
  head/sys/kern/kern_exit.c

Modified: head/sys/kern/kern_exit.c
==============================================================================
--- head/sys/kern/kern_exit.c	Fri Dec  7 12:22:32 2018	(r341684)
+++ head/sys/kern/kern_exit.c	Fri Dec  7 12:32:25 2018	(r341685)
@@ -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.
 	 */
@@ -458,6 +457,8 @@ exit1(struct thread *td, int rval, int signo)
 	LIST_INSERT_HEAD(&zombproc, p, p_list);
 	sx_xunlock(&zombproc_lock);
 	sx_xunlock(&allproc_lock);
+
+	sx_xlock(&proctree_lock);
 
 	/*
 	 * Reparent all children processes:


More information about the svn-src-all mailing list