From owner-cvs-all@FreeBSD.ORG Sun Feb 1 18:35:59 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 35FB616A4CE; Sun, 1 Feb 2004 18:35:59 -0800 (PST) Received: from mailout1.pacific.net.au (mailout1.pacific.net.au [61.8.0.84]) by mx1.FreeBSD.org (Postfix) with ESMTP id 707E043D3F; Sun, 1 Feb 2004 18:35:57 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from mailproxy1.pacific.net.au (mailproxy1.pacific.net.au [61.8.0.86])i122ZrLE020330; Mon, 2 Feb 2004 13:35:53 +1100 Received: from gamplex.bde.org (katana.zip.com.au [61.8.7.246]) i122Zpt4024056; Mon, 2 Feb 2004 13:35:51 +1100 Date: Mon, 2 Feb 2004 13:35:50 +1100 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Jeff Roberson In-Reply-To: <20040201180709.V36463-100000@mail.chesapeake.net> Message-ID: <20040202131218.M741@gamplex.bde.org> References: <20040201180709.V36463-100000@mail.chesapeake.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: cvs-src@FreeBSD.org cc: Don Lewis cc: src-committers@FreeBSD.org cc: jeff@FreeBSD.org cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/kern sched_4bsd.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, 02 Feb 2004 02:35:59 -0000 On Sun, 1 Feb 2004, Jeff Roberson wrote: > On Sun, 1 Feb 2004, Bruce Evans wrote: > > > On Sat, 31 Jan 2004, Don Lewis wrote: > > > > > On 31 Jan, Jeff Roberson wrote: > > > > jeff 2004/01/31 18:46:47 PST > > > > > > > > FreeBSD src repository > > > > > > > > Modified files: > > > > sys/kern sched_4bsd.c > > > > Log: > > > > - Keep a variable 'sched_tdcnt' that is used for the local implementation > > > > of sched_load(). This variable tracks the number of running and runnable > > > > non ithd threads. This removes the need to traverse the proc table and > > > > discover how many threads are runnable. > > > > Traversing the run queues in sched_load() every 5 seconds might be more > > efficient than maintaing the count. > > It might be cheaper, but it is less scalable. Er, I want it because it is similarly scalable and probably cheaper on all scales. Maintaining the count is O(n) in the number of run queue operations, while traversing the run queues is O(n) in the total length of the queues. The total length of the queues (divided by the number of CPUs) should be much smaller than the number of run queue operations (else the machine is overloaded). Traversing the queues is O(n) in the number of CPUs, but that doesn't matter since if there are enough CPUs for it to take very long then there are enough CPUs to spare one for long enough to run it. Bruce