From owner-svn-src-all@FreeBSD.ORG Wed Mar 23 15:28:49 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C13E1065673; Wed, 23 Mar 2011 15:28:49 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id D3B908FC12; Wed, 23 Mar 2011 15:28:48 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 8CE5746B32; Wed, 23 Mar 2011 11:28:48 -0400 (EDT) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 2E1308A01B; Wed, 23 Mar 2011 11:28:48 -0400 (EDT) From: John Baldwin To: Kostik Belousov Date: Wed, 23 Mar 2011 11:25:47 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.4-CBSD-20110107; KDE/4.4.5; amd64; ; ) References: <201103180647.p2I6lNCB051745@svn.freebsd.org> <201103230945.37726.jhb@freebsd.org> <20110323143434.GZ78089@deviant.kiev.zoral.com.ua> In-Reply-To: <20110323143434.GZ78089@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201103231125.48082.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Wed, 23 Mar 2011 11:28:48 -0400 (EDT) Cc: svn-src-head@freebsd.org, Edward Tomasz Napierala , svn-src-all@freebsd.org, src-committers@freebsd.org, Julian Elischer Subject: Re: svn commit: r219727 - head/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 23 Mar 2011 15:28:49 -0000 On Wednesday, March 23, 2011 10:34:34 am Kostik Belousov wrote: > On Wed, Mar 23, 2011 at 09:45:37AM -0400, John Baldwin wrote: > > On Friday, March 18, 2011 4:40:34 am Julian Elischer wrote: > > > On 3/17/11 11:47 PM, Edward Tomasz Napierala wrote: > > > > Author: trasz > > > > Date: Fri Mar 18 06:47:23 2011 > > > > New Revision: 219727 > > > > URL: http://svn.freebsd.org/changeset/base/219727 > > > > > > > > Log: > > > > In vm_daemon(), when iterating over all processes in the system, skip those > > > > which are not yet fully initialized (i.e. ones with p_state == PRS_NEW). > > > > Without it, we could panic in _thread_lock_flags(). > > > > > > > > Note that there may be other instances of FOREACH_PROC_IN_SYSTEM() that > > > > require similar fix. > > > > > > In the past each process was only put on the process list after it was > > > fully set up. > > > Did someone change that recently? that would be "A Bad Thing" (TM). > > > > Err, no, that has never been true. The reason it has to go on the list > > immediately is to reserve the PID against concurrent fork()s. > > > > Hmm, the locking of prs_state is a bit busted it seems. Both the PROC_LOCK() > > and PROC_SLOCK() are supposed to be held when it is written to, but > > PROC_LOCK() is missing in fork1() when moving the state to PRS_NORMAL. > > > > Also, this commit should check against PRS_NORMAL after acquiring the proc > > lock, not before. > In the case of this commit, it does not matter much, I think. The reason > is that all the check want is to make sure that there is at least one > fully initialized thread linked into the process. It already checks other things under the proc lock, so it costs nothing to be completely correct in this case. -- John Baldwin