From owner-cvs-all Thu Jul 5 18: 0:38 2001 Delivered-To: cvs-all@freebsd.org Received: from mail12.speakeasy.net (mail12.speakeasy.net [216.254.0.212]) by hub.freebsd.org (Postfix) with SMTP id B89FD37B405 for ; Thu, 5 Jul 2001 18:00:28 -0700 (PDT) (envelope-from jhb@FreeBSD.org) Received: (qmail 29554 invoked from network); 6 Jul 2001 01:00:27 -0000 Received: from unknown (HELO laptop.baldwin.cx) ([64.81.54.73]) (envelope-sender ) by mail12.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 6 Jul 2001 01:00:27 -0000 Message-ID: X-Mailer: XFMail 1.4.0 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <200107052228.f65MSeU64741@aslan.scsiguy.com> Date: Thu, 05 Jul 2001 18:00:24 -0700 (PDT) From: John Baldwin To: "Justin T. Gibbs" Subject: Re: cvs commit: src/sys/sys systm.h condvar.h src/sys/kern kern_ Cc: Doug Rabson , Matthew Jacob , Matt Dillon , cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org, Jake Burkholder , Alfred Perlstein 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 05-Jul-01 Justin T. Gibbs wrote: >>It happens with SMP, too, not just preemption. The calls are an optimization >>to avoid problems with releasing the lock after the wakeup. The contention >>can be avoided if we release the lock before calling wakeup(), but doing that >>leaves a window open for another CPU to alter the data that the lock protects >>possibly invalidating the wakeup that then gets sent. > > This window exists anyway. The locked mutex it not passed to the woken > up thread, so there will always be a race between the woken up thread > acquiring the mutex and some other thread on some other CPU acquiring it > first and making the wakeup invalid. Ok, then releasing the lock prior to wakeup/cv_foo is fine with me. -- John Baldwin -- http://www.FreeBSD.org/~jhb/ PGP Key: http://www.baldwin.cx/~john/pgpkey.asc "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message