svn commit: r280131 - head/sys/kern

Mateusz Guzik mjg at FreeBSD.org
Mon Mar 16 01:09:50 UTC 2015


Author: mjg
Date: Mon Mar 16 01:09:49 2015
New Revision: 280131
URL: https://svnweb.freebsd.org/changeset/base/280131

Log:
  proc: get rid of proc lock + unlock pair in proc_reap
  
  A comment in the code stated we PROC_LOCK and as a side effect guarantee
  all writers released process lock. But at that point such lock was already
  taken while we were removing the process from all lists, so it should be already
  unreachable.

Modified:
  head/sys/kern/kern_exit.c

Modified: head/sys/kern/kern_exit.c
==============================================================================
--- head/sys/kern/kern_exit.c	Mon Mar 16 00:10:03 2015	(r280130)
+++ head/sys/kern/kern_exit.c	Mon Mar 16 01:09:49 2015	(r280131)
@@ -887,12 +887,13 @@ proc_reap(struct thread *td, struct proc
 	sx_xunlock(&proctree_lock);
 
 	/*
-	 * As a side effect of this lock, we know that all other writes to
-	 * this proc are visible now, so no more locking is needed for p.
+	 * Removal from allproc list and process group list paired with
+	 * PROC_LOCK which was executed during that time should guarantee
+	 * nothing can reach this process anymore. As such further locking
+	 * is unnecessary.
 	 */
-	PROC_LOCK(p);
 	p->p_xstat = 0;		/* XXX: why? */
-	PROC_UNLOCK(p);
+
 	PROC_LOCK(q);
 	ruadd(&q->p_stats->p_cru, &q->p_crux, &p->p_ru, &p->p_rux);
 	PROC_UNLOCK(q);


More information about the svn-src-head mailing list