From owner-freebsd-current@FreeBSD.ORG Tue Jul 8 15:56:21 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6764537B401; Tue, 8 Jul 2003 15:56:21 -0700 (PDT) Received: from rwcrmhc12.comcast.net (rwcrmhc12.comcast.net [216.148.227.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9CB8F43F85; Tue, 8 Jul 2003 15:56:19 -0700 (PDT) (envelope-from julian@elischer.org) Received: from interjet.elischer.org ([12.233.125.100]) by attbi.com (rwcrmhc12) with ESMTP id <200307082256190140063c6le>; Tue, 8 Jul 2003 22:56:19 +0000 Received: from localhost (localhost.elischer.org [127.0.0.1]) by InterJet.elischer.org (8.9.1a/8.9.1) with ESMTP id PAA24460; Tue, 8 Jul 2003 15:56:18 -0700 (PDT) Date: Tue, 8 Jul 2003 15:56:17 -0700 (PDT) From: Julian Elischer To: John Baldwin In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: FreeBSD current users Subject: RE: SMP and setrunnable()- scheduler 4bsd X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Jul 2003 22:56:21 -0000 On Tue, 8 Jul 2003, John Baldwin wrote: > > On 08-Jul-2003 Julian Elischer wrote: > > It looks tp me that if we make a thread runnable > > and there is a processor in the idle loop, the idle processor should be > > kicked in some way to make it go get the newly runnable thread. > > > > If the processors are halting in the idle loop however, it may take > > quite a while for the new work to be noticed.. > > (possibly up to milliseconds I think) > > > > Is there a mechanism to send an IPI to particular processors? > > or is it just broadcast? > > > > > > I think we would be better served to alter idle_proc(void *dummy) > > (or maybe choosethread()) to increment or decrement a count > > of idle processors (atomically of course) so that > > setrunnable (or it's lower parts) can send that IPI > > and get the idle processor into actioan as soon as a thread is > > available. > > > > I have not seen any such code but maybe I'm wrong.... > > This is why HLT is not enabled in SMP by default (or at least was, > it may be turned on now). Given that the clock interrupts are > effectively broadcast to all CPU's one way or another for all > arch's (that I know of), you will never halt more than the interval > between clock ticks on any CPU. I think that this tells me that we shoould do as I suggest above.. :-) i.e. keep a count of idle processors (idlethreads running) and if there is an idle processessor when a thread becomes available, kick one of the idle processes to wake up. On a busy system it shuold never happen. I guess we could make a scheduler method to do this if the scheduler is going to choose which processor a thread will be run on, and if the hardware doesn't support selecting a particular target, then we could broadcast it... I doubt the overhead would be more than the reduction of latency for threaded apps. > > -- > > John Baldwin <>< http://www.FreeBSD.org/~jhb/ > "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ >