From owner-svn-src-all@FreeBSD.ORG Mon Dec 8 17:22:37 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8DB071065715; Mon, 8 Dec 2008 17:22:37 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 0E83D8FC18; Mon, 8 Dec 2008 17:22:36 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [IPv6:::1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id mB8HMIXQ002722; Mon, 8 Dec 2008 12:22:30 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Roman Divacky Date: Mon, 8 Dec 2008 11:50:51 -0500 User-Agent: KMail/1.9.7 References: <200812052050.mB5KoOcV072648@svn.freebsd.org> <20081205224600.GA16948@freebsd.org> In-Reply-To: <20081205224600.GA16948@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200812081150.52312.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [IPv6:::1]); Mon, 08 Dec 2008 12:22:31 -0500 (EST) X-Virus-Scanned: ClamAV version 0.94.2, clamav-milter version 0.94.2 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00,NO_RELAYS autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Konstantin Belousov Subject: Re: svn commit: r185647 - in head/sys: kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Dec 2008 17:22:37 -0000 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