svn commit: r185647 - in head/sys: kern sys

John Baldwin jhb at freebsd.org
Mon Dec 8 09:22:37 PST 2008


On Friday 05 December 2008 05:46:00 pm Roman Divacky wrote:
> On Fri, Dec 05, 2008 at 08:50:24PM +0000, Konstantin Belousov wrote:
> > Author: kib
> > Date: Fri Dec  5 20:50:24 2008
> > New Revision: 185647
> > URL: http://svn.freebsd.org/changeset/base/185647
> > 
> > Log:
> >   Several threads in a process may do vfork() simultaneously. Then, all
> >   parent threads sleep on the parent' struct proc until corresponding
> >   child releases the vmspace. Each sleep is interlocked with proc mutex of
> >   the child, that triggers assertion in the sleepq_add(). The assertion
> >   requires that at any time, all simultaneous sleepers for the channel use
> >   the same interlock.
> >   
> >   Silent the assertion by using conditional variable allocated in the
> >   child. Broadcast the variable event on exec() and exit().
> >   
> >   Since struct proc * sleep wait channel is overloaded for several
> >   unrelated events, I was unable to remove wakeups from the places where
> >   cv_broadcast() is added, except exec().
> 
> are there any differences (performance etc.) in using condition variables
> instead of sleep/wakeup?

They are both just wrappers around sleepq_*.  cv does have a minor 
optimization where it attempts to avoid calling the sleepq_* code directly 
during a broadcast/signal if there are zero waiters.  wakeup/wakeup_one 
always look in the hash table and walk the hash bucket via sleepq_*.

-- 
John Baldwin


More information about the svn-src-all mailing list