From owner-svn-src-stable@freebsd.org Sat Dec 31 13:07:10 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 83641C98EB0; Sat, 31 Dec 2016 13:07:10 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 52BEF1B1B; Sat, 31 Dec 2016 13:07:10 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBVD79Tp092591; Sat, 31 Dec 2016 13:07:09 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBVD79GB092590; Sat, 31 Dec 2016 13:07:09 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201612311307.uBVD79GB092590@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 31 Dec 2016 13:07:09 +0000 (UTC) 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 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 13:07:10 -0000 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; }