From owner-cvs-all@FreeBSD.ORG Mon Nov 1 04:53:32 2004 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9B9E716A4CE; Mon, 1 Nov 2004 04:53:32 +0000 (GMT) Received: from cs.rice.edu (cs.rice.edu [128.42.1.30]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6D3C743D41; Mon, 1 Nov 2004 04:53:32 +0000 (GMT) (envelope-from alc@cs.rice.edu) Received: from localhost (calypso.cs.rice.edu [128.42.1.127]) by cs.rice.edu (Postfix) with ESMTP id 20C9B4AC1F; Sun, 31 Oct 2004 22:53:32 -0600 (CST) Received: from cs.rice.edu ([128.42.1.30]) by localhost (calypso.cs.rice.edu [128.42.1.127]) (amavisd-new, port 10024) with LMTP id 20346-01-26; Sun, 31 Oct 2004 22:53:31 -0600 (CST) Received: by cs.rice.edu (Postfix, from userid 19572) id BC9454AC1E; Sun, 31 Oct 2004 22:53:31 -0600 (CST) Date: Sun, 31 Oct 2004 22:53:31 -0600 From: Alan Cox To: Alfred Perlstein Message-ID: <20041101045331.GP16728@cs.rice.edu> References: <200410311932.i9VJWvmo058193@repoman.freebsd.org> <20041101031317.GK24892@elvis.mu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20041101031317.GK24892@elvis.mu.org> User-Agent: Mutt/1.4.2i X-Virus-Scanned: by amavis-20030616-p7 at cs.rice.edu cc: Alan Cox cc: cvs-src@FreeBSD.org cc: src-committers@FreeBSD.org cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/vm vm_zeroidle.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Nov 2004 04:53:32 -0000 On Sun, Oct 31, 2004 at 07:13:17PM -0800, Alfred Perlstein wrote: > * Alan Cox [041031 11:33] wrote: > > alc 2004-10-31 19:32:57 UTC > > > > FreeBSD src repository > > > > Modified files: > > sys/vm vm_zeroidle.c > > Log: > > Introduce a Boolean variable wakeup_needed to avoid repeated, unnecessary > > calls to wakeup() by vm_page_zero_idle_wakeup(). > > > > Revision Changes Path > > 1.31 +9 -2 src/sys/vm/vm_zeroidle.c > > Why not switch to a cv? Calling cv_signal repeatedly would be no better than calling wakeup() repeatedly. Either way, a Boolean variable is desirable to prevent unnecessary calls. As for the question of msleep()/wakeup() vs. cv_wait*()/cv_signal(), cv_wait*() has no analogue to msleep()'s PDROP. In this case, there is no need to hold the lock after returning from the sleep. So, msleep(PDROP) is better suited to this case. Regards, Alan