cvs commit: src/sys/kern kern_fork.c

John Baldwin jhb at FreeBSD.org
Mon Oct 4 09:31:48 PDT 2004


On Monday 04 October 2004 11:38 am, David Schultz wrote:
> On Mon, Oct 04, 2004, John Baldwin wrote:
> > On Friday 01 October 2004 01:01 am, David Schultz wrote:
> > > das         2004-10-01 05:01:29 UTC
> > >
> > >   FreeBSD src repository
> > >
> > >   Modified files:
> > >     sys/kern             kern_fork.c
> > >   Log:
> > >   Avoid calling _PHOLD(p1) with p2's lock held, since _PHOLD()
> > >   may block to swap in p1.  Instead, call _PHOLD earlier, at a
> > >   point where the only lock held happens to be p1's.
> >
> > FWIW, I don't think this can actually happen because curthread belonging
> > to p1 is executing and it wouldn't be executing unless it was swapped in,
> > so I don't think that PHOLD could ever have blocked.
>
> Yes, you're right.  I'll revert this one.  Shall I also change the
> _PHOLD() into simply p1->p_lock++ (and similarly for _PRELE()) to
> avoid the useless test?

Nah, I would just leave it as _PHOLD() since it's easier when reading the code 
to see the matching pair.

-- 
John Baldwin <jhb at FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org


More information about the cvs-src mailing list