Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Dec 2018 12:32:26 +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: r341685 - head/sys/kern
Message-ID:  <201812071232.wB7CWQOT053385@repo.freebsd.org>

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



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