On Sat, Dec 06, 2008 at 08:23:44PM -0700, M. Warner Losh wrote:
> In message: <[EMAIL PROTECTED]>
>             Kostik Belousov <[EMAIL PROTECTED]> writes:
> : On Fri, Dec 05, 2008 at 11:46:00PM +0100, 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?
> : 
> : I do not think that there is any measurable difference. On the other
> : hand, the patch makes struct proc bigger by int + pointer. This shall
> : not be a problem too.
> : 
> : Would I been able to convert _all_ uses of the struct proc * wait channel
> : to cond vars operation, this may be measurable on some loads, since it
> : would exclude spurious wakeups.
> 
> Is that a measurable good difference, or a measurable bad difference?

I expect this could be measurable good difference, i.e. such patch might
improve performance on some loads by eliminating false wakeups.

Attachment: pgpLJhOY3kc2C.pgp
Description: PGP signature

Reply via email to