From owner-cvs-all Sat Jul 7 22: 3:13 2001 Delivered-To: cvs-all@freebsd.org Received: from wantadilla.lemis.com (wantadilla.lemis.com [192.109.197.80]) by hub.freebsd.org (Postfix) with ESMTP id 6072637B403; Sat, 7 Jul 2001 22:03:05 -0700 (PDT) (envelope-from grog@lemis.com) Received: by wantadilla.lemis.com (Postfix, from userid 1004) id 065606ACBC; Sun, 8 Jul 2001 14:33:04 +0930 (CST) Date: Sun, 8 Jul 2001 14:33:03 +0930 From: Greg Lehey To: Sergey Babkin Cc: Matt Dillon , Alfred Perlstein , "Justin T. Gibbs" , John Baldwin , Jake Burkholder , cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org, Matthew Jacob , Doug Rabson Subject: Re: cvs commit: src/sys/sys systm.h condvar.h src/sys/kern kern_ Message-ID: <20010708143303.Z80862@wantadilla.lemis.com> References: <200107052228.f65MSeU64741@aslan.scsiguy.com> <20010705174135.A79818@sneakerz.org> <200107060214.f662ElT61708@earth.backplane.com> <20010708110449.E75626@wantadilla.lemis.com> <3B47E2EF.3022DF3F@bellatlantic.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <3B47E2EF.3022DF3F@bellatlantic.net>; from babkin@bellatlantic.net on Sun, Jul 08, 2001 at 12:34:55AM -0400 Organization: The FreeBSD Project Phone: +61-8-8388-8286 Fax: +61-8-8388-8725 Mobile: +61-418-838-708 WWW-Home-Page: http://www.FreeBSD.org/ X-PGP-Fingerprint: 6B 7B C3 8C 61 CD 54 AF 13 24 52 F8 6D A4 95 EF Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sunday, 8 July 2001 at 0:34:55 -0400, Sergey Babkin wrote: > Greg Lehey wrote: >> >>>> Y'know this sorta got me thinking about something else, shouldn't the >>>> wakeup() calls for most exclusive locks use wakeup_one? I know >>>> wakeup_one() hoses priority, but for the locks in things like vnodes >>>> and the pager locks, shouldn't we do a wakeup_one() since it is an >>>> exclusive lock? >>>> >>>> -- >>>> -Alfred Perlstein [alfred@freebsd.org] >>> >>> I would not recommend using wakeup_one until 5.2ish. A mistake could >>> result in hard-to-find system lockups. >> >> I would not recommend using wakeup_one. It has the potential to hang >> the system. >> >> One of the tradeoffs in the sleep/wakeup paradigm is that you wait on >> an arbitrary address. This works fine as long as you wake up *every* >> process. But consider two independent subsystems which wait on the >> same address. wakeup_one wakes the first waiter on the list, which >> happens to belong to the other subsystem. It checks its environment >> and goes back to sleep. Bingo! The first subsystem has lost a >> wakeup. > > Hm, my understanding is that the intended "standard" way of using the > likes of wakeup_one (such as sVr4.mp condition variable non-broadcast > signalling) is that after the woken up process/thread completes its > work it _must_ check if anybody else is sleeping on the same > condition and wake up the next sleeper. Hmm. But I haven't seen that documented anywhere. It also places the responsibility in the wrong place IMO. > The idea is that the conditional variable protects a resource that > may only be used by one process at a time, so to avoid waking up all > the potential herd of sleeping processes only to get all of them but > one to check the condition and go to sleep again, only one process > is woken up at a time, and after it's done it must wake up the next > one. I'd say that any other use of such non-broadcast wakeup is > probably bogus. The problem is that you need to choose your condition pretty carefully. I suppose that's possible. I haven't thought it through yet. Greg -- See complete headers for address and phone numbers To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message