Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 31 Dec 2016 13:07:09 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r310971 - stable/11/sys/kern
Message-ID:  <201612311307.uBVD79GB092590@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mjg
Date: Sat Dec 31 13:07:09 2016
New Revision: 310971
URL: https://svnweb.freebsd.org/changeset/base/310971

Log:
  MFC r309111:
  
      wait: avoid relocking the child if proc_to_reap returns 1
  
      proc_to_reap would always unlock. However, if it returned 1, kern_wait6
      would immediately lock it again. Save the dance.

Modified:
  stable/11/sys/kern/kern_exit.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/kern_exit.c
==============================================================================
--- stable/11/sys/kern/kern_exit.c	Sat Dec 31 13:05:48 2016	(r310970)
+++ stable/11/sys/kern/kern_exit.c	Sat Dec 31 13:07:09 2016	(r310971)
@@ -1066,7 +1066,6 @@ proc_to_reap(struct thread *td, struct p
 		proc_reap(td, p, status, options);
 		return (-1);
 	}
-	PROC_UNLOCK(p);
 	return (1);
 }
 
@@ -1199,7 +1198,7 @@ loop:
 			return (0);
 		}
 
-		PROC_LOCK(p);
+		PROC_LOCK_ASSERT(p, MA_OWNED);
 
 		if ((options & (WTRAPPED | WUNTRACED)) != 0)
 			PROC_SLOCK(p);
@@ -1259,6 +1258,7 @@ loop:
 			if (ret != 0) {
 				KASSERT(ret != -1, ("reaped an orphan (pid %d)",
 				    (int)td->td_retval[0]));
+				PROC_UNLOCK(p);
 				nfound++;
 				break;
 			}



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