From owner-freebsd-arch@FreeBSD.ORG Sat Oct 18 13:02:31 2003 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 32F8316A4B3 for ; Sat, 18 Oct 2003 13:02:31 -0700 (PDT) Received: from rootlabs.com (root.org [67.118.192.226]) by mx1.FreeBSD.org (Postfix) with SMTP id 92CD843FA3 for ; Sat, 18 Oct 2003 13:02:28 -0700 (PDT) (envelope-from nate@rootlabs.com) Received: (qmail 47249 invoked by uid 1000); 18 Oct 2003 20:02:29 -0000 Date: Sat, 18 Oct 2003 13:02:29 -0700 (PDT) From: Nate Lawson To: arch@freebsd.org Message-ID: <20031018130119.T47207@root.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Variable timer tick rate? X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Oct 2003 20:02:31 -0000 This is an interesting approach. If there are no upcoming timeouts, decrease the tick rate. Of course, you have to amortize the cost of resetting the timer over the period of no ticks. http://kerneltrap.org/node/view/1006 -Nate From owner-freebsd-arch@FreeBSD.ORG Sat Oct 18 13:05:43 2003 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BDDC816A4B3 for ; Sat, 18 Oct 2003 13:05:43 -0700 (PDT) Received: from critter.freebsd.dk (critter.freebsd.dk [212.242.86.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7E7DB43FCB for ; Sat, 18 Oct 2003 13:05:42 -0700 (PDT) (envelope-from phk@phk.freebsd.dk) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.12.10/8.12.10) with ESMTP id h9IK5eon009671; Sat, 18 Oct 2003 22:05:40 +0200 (CEST) (envelope-from phk@phk.freebsd.dk) To: Nate Lawson From: "Poul-Henning Kamp" In-Reply-To: Your message of "Sat, 18 Oct 2003 13:02:29 PDT." <20031018130119.T47207@root.org> Date: Sat, 18 Oct 2003 22:05:40 +0200 Message-ID: <9670.1066507540@critter.freebsd.dk> cc: arch@freebsd.org Subject: Re: Variable timer tick rate? X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Oct 2003 20:05:43 -0000 In message <20031018130119.T47207@root.org>, Nate Lawson writes: >This is an interesting approach. If there are no upcoming timeouts, >decrease the tick rate. Of course, you have to amortize the cost of >resetting the timer over the period of no ticks. > >http://kerneltrap.org/node/view/1006 Yes, unfortunately we may have a couple of timeout() (ab)users which use it to implement "as fast as possible polling" by calling timeout with a 1 tick argument, so last I looked (a couple of years ago) it fired every tick. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From owner-freebsd-arch@FreeBSD.ORG Sat Oct 18 14:17:36 2003 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 47AC316A4B3 for ; Sat, 18 Oct 2003 14:17:36 -0700 (PDT) Received: from VARK.homeunix.com (adsl-68-124-23-137.dsl.pltn13.pacbell.net [68.124.23.137]) by mx1.FreeBSD.org (Postfix) with ESMTP id 86EF843F75 for ; Sat, 18 Oct 2003 14:17:34 -0700 (PDT) (envelope-from das@FreeBSD.ORG) Received: from VARK.homeunix.com (localhost [127.0.0.1]) by VARK.homeunix.com (8.12.9/8.12.9) with ESMTP id h9ILHX2O023815; Sat, 18 Oct 2003 14:17:33 -0700 (PDT) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by VARK.homeunix.com (8.12.9/8.12.9/Submit) id h9ILHXFX023814; Sat, 18 Oct 2003 14:17:33 -0700 (PDT) (envelope-from das@FreeBSD.ORG) Date: Sat, 18 Oct 2003 14:17:33 -0700 From: David Schultz To: Nate Lawson Message-ID: <20031018211733.GA14976@VARK.homeunix.com> Mail-Followup-To: Nate Lawson , arch@FreeBSD.ORG References: <20031018130119.T47207@root.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20031018130119.T47207@root.org> cc: arch@FreeBSD.ORG Subject: Re: Variable timer tick rate? X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Oct 2003 21:17:36 -0000 On Sat, Oct 18, 2003, Nate Lawson wrote: > This is an interesting approach. If there are no upcoming timeouts, > decrease the tick rate. Of course, you have to amortize the cost of > resetting the timer over the period of no ticks. > > http://kerneltrap.org/node/view/1006 For the last couple of years, Solaris has had a 'cyclic' system that automatically schedules the next clock interrupt to match the next timeout. This allows for arbitrarily high or low resolution timers. Even if we presently have subsystems that poll every tick, high-resolution timers would be a neat thing to have, and it should be possible to implement on all supported architectures except pre-PPro i386's that don't have TSCs. From owner-freebsd-arch@FreeBSD.ORG Sat Oct 18 16:25:31 2003 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 962C916A4B3 for ; Sat, 18 Oct 2003 16:25:31 -0700 (PDT) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 23A9143FCB for ; Sat, 18 Oct 2003 16:25:30 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from gamplex.bde.org (katana.zip.com.au [61.8.7.246]) by mailman.zeta.org.au (8.9.3p2/8.8.7) with ESMTP id JAA16145; Sun, 19 Oct 2003 09:25:12 +1000 Date: Sun, 19 Oct 2003 09:23:51 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Poul-Henning Kamp In-Reply-To: <9670.1066507540@critter.freebsd.dk> Message-ID: <20031019091024.O2998@gamplex.bde.org> References: <9670.1066507540@critter.freebsd.dk> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: arch@freebsd.org cc: Nate Lawson Subject: Re: Variable timer tick rate? X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Oct 2003 23:25:31 -0000 On Sat, 18 Oct 2003, Poul-Henning Kamp wrote: > In message <20031018130119.T47207@root.org>, Nate Lawson writes: > > >This is an interesting approach. If there are no upcoming timeouts, > >decrease the tick rate. Of course, you have to amortize the cost of > >resetting the timer over the period of no ticks. > > > >http://kerneltrap.org/node/view/1006 Doing this to increase (instead of decrease) the tick rate is an old topic. I think it would have too high an overhead (at least for the increase case, at least on i386's), since reprogramming the i8254 timer takes a few usec. A few usec every 1/HZ for the default HZ wouldn't be too bad. > Yes, unfortunately we may have a couple of timeout() (ab)users which > use it to implement "as fast as possible polling" by calling timeout > with a 1 tick argument, so last I looked (a couple of years ago) > it fired every tick. Also, some things like to increase HZ to 1000 or more to poll faster, so even the timeout users that don't know better than to use a timeout of 1 tick get faster polling. Bruce