svn commit: r219727 - head/sys/vm
John Baldwin
jhb at freebsd.org
Wed Mar 23 15:28:49 UTC 2011
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
More information about the svn-src-head
mailing list