From owner-svn-src-all@FreeBSD.ORG Mon Mar 16 01:09:50 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AD78EBC7; Mon, 16 Mar 2015 01:09:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 99336152; Mon, 16 Mar 2015 01:09:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t2G19oL4050866; Mon, 16 Mar 2015 01:09:50 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t2G19oeb050865; Mon, 16 Mar 2015 01:09:50 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201503160109.t2G19oeb050865@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 16 Mar 2015 01:09:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r280131 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Mar 2015 01:09:50 -0000 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);