From owner-freebsd-hackers@FreeBSD.ORG Fri Dec 4 22:34:25 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CF3181065672; Fri, 4 Dec 2009 22:34:25 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 9FF5E8FC15; Fri, 4 Dec 2009 22:34:25 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 391FA46B38; Fri, 4 Dec 2009 17:34:25 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 7956A8A01F; Fri, 4 Dec 2009 17:34:24 -0500 (EST) From: John Baldwin To: Ivan Voras Date: Fri, 4 Dec 2009 17:32:49 -0500 User-Agent: KMail/1.12.1 (FreeBSD/7.2-CBSD-20091103; KDE/4.3.1; amd64; ; ) References: <200912041047.08253.jhb@freebsd.org> <9bbcef730912041309m51ce4858q42937e0f76f94cda@mail.gmail.com> In-Reply-To: <9bbcef730912041309m51ce4858q42937e0f76f94cda@mail.gmail.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <200912041732.50026.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Fri, 04 Dec 2009 17:34:24 -0500 (EST) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: freebsd-hackers@freebsd.org Subject: Re: Request for information - timers, hz, interrupts X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2009 22:34:25 -0000 On Friday 04 December 2009 4:09:59 pm Ivan Voras wrote: > 2009/12/4 John Baldwin : > > On Friday 04 December 2009 9:52:39 am Ivan Voras wrote: > >> For a long time, at least in the 6-stable timeframe, I was used to > >> seeing timer interrupts going at the frequency of 2*HZ, e.g. this is > >> from 6.4-RELEASE: > >> > >> kern.clockrate: { hz = 250, tick = 4000, profhz = 1000, stathz = 142 } > >> kern.hz: 250 > > > It actually was changed to provide saner behavior when you use low hz values > > like 'hz=100'. Note that your stathz is now 142 instead of 33. The scheduler > > is likely far happier with that stathz. There is more detail in the commit > > log I believe (just look at the logs for local_apic.c in either svn or > > cvsweb). > > Ok. Some more questions: > > What does "ticks" do in the above sysctl output? 'tick' is the number of microseconds per clock tick. Since you run hz at 250, that gives you 4ms = 4000us per clock tick. > So 4000 interrupts/s per CPU in the default configuration isn't > considered excessive? :) The default configuration is hz = 1000 which gives you an interrupt rate of 2000 interrupts/s per CPU and a stathz of 133. With your setting of hz=250, you have an interrupt rate of 1000 interrupts/s per CPU. > I see stathz isn't a divisor of any number in kern.clockrate, which > probably means it's not triggered from one of them firing; can't it be > a separately configurable value? No, it is driven by the tick timer. It ends up running at something more like 142.8571428571 when you have hz = 250. (So some seconds it will fire 143 times rather than 142.) The kernel tries to run stathz as close to 128 as possible, but ~142 is what it comes up with. It should probably try the next divisor "up" and take the resulting stathz that is the closest to 128. That would let stathz run at 125 on your machine instead of ~142. -- John Baldwin