Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Dec 2008 11:50:51 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        Roman Divacky <rdivacky@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Konstantin Belousov <kib@freebsd.org>
Subject:   Re: svn commit: r185647 - in head/sys: kern sys
Message-ID:  <200812081150.52312.jhb@freebsd.org>
In-Reply-To: <20081205224600.GA16948@freebsd.org>
References:  <200812052050.mB5KoOcV072648@svn.freebsd.org> <20081205224600.GA16948@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812081150.52312.jhb>