From owner-freebsd-hackers@FreeBSD.ORG Mon Apr 5 14:17:32 2010 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 C1B7E106564A; Mon, 5 Apr 2010 14:17:32 +0000 (UTC) (envelope-from ozawa@t-oza.net) Received: from mail-ww0-f54.google.com (mail-ww0-f54.google.com [74.125.82.54]) by mx1.freebsd.org (Postfix) with ESMTP id 1073D8FC0A; Mon, 5 Apr 2010 14:17:31 +0000 (UTC) Received: by wwb24 with SMTP id 24so2493215wwb.13 for ; Mon, 05 Apr 2010 07:17:30 -0700 (PDT) MIME-Version: 1.0 Sender: ozawa@t-oza.net Received: by 10.216.187.209 with HTTP; Mon, 5 Apr 2010 07:17:30 -0700 (PDT) X-Originating-IP: [59.86.12.84] In-Reply-To: <86iq8csmzl.fsf@ds4.des.no> References: <411a180c1003300537g2a1b4879u2d8d952ce9977cb5@mail.gmail.com> <411a180c1003300639l13d33451q305a61b2bcd6e3d5@mail.gmail.com> <20100330173504.GA70578@freebsd.org> <86iq8csmzl.fsf@ds4.des.no> Date: Mon, 5 Apr 2010 06:17:30 -0800 X-Google-Sender-Auth: db7bb31da402446d Received: by 10.216.85.203 with SMTP id u53mr3623995wee.184.1270477050692; Mon, 05 Apr 2010 07:17:30 -0700 (PDT) Message-ID: From: Tsuyoshi Ozawa To: =?ISO-8859-1?Q?Dag=2DErling_Sm=F8rgrav?= , John Baldwin , Julian Elischer , Artem Belevich , Roman Divacky , Andriy Gapon Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers Subject: Re: Dynamic ticks in FreeBSD 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: Mon, 05 Apr 2010 14:17:32 -0000 Thank you for replying, and sorry for delaying to reply for my network reas= on. I'm very happy that you all give me very useful advice :D 2010/3/31 Andriy Gapon : > 1. Instead of firing clock (LAPIC timer) interrupt regularly with a frequ= ency > derived from HZ, the interrupt is scheduled to fire (in one-shot mode) at= the time > of the soonest scheduled callout. > 2. The code also makes sure to run hard/stat/prof-clocks if time since la= st > interrupt is greater than their respective periods in !dyntick mode. Yes, that's right. > Thus, it appears that in dyntick mode hard/stat/prof-clocks would run irr= egularly. > I couldn't find any code that makes sure that the rest of the system hand= les this > properly. Perhaps I missed it, or is it still in progress/plans? Yeah, this is in progress. Next step is to support to hard/stat/prof-clocks run irregularly. Now, I'm reading code to understand how they work correctly in dyntick mode= . > Also, I am not sure if the code handles the case when a new 'soonest' cal= lout is > scheduled after we already decided when to fire the next LAPIC timer inte= rrupt. In current version, this case is going to be ignored ( do nothing ). This is bug, and I'll fix it. 2010/3/31 Roman Divacky : > I wonder - why don't we store the callouts in binary > tree so the searching for nearest callout is faster? Is it time to have another look at callout queue implementation for this wo= rk? Or another implementation is to make callout queue have the nearest tick va= lue. This costs O(1). > > what is the average length of the callout queue? I'm going to monitor it. 2010/3/31 Artem Belevich : > Are you doing anything to handle the case where the lapic timer is turned= off > when a CPU enters C2 or C3? No. Hmm, this is very big problem. > The ideal approach in my mind would be to not use > the lapic timer at all when running in a deadline mode, but give each CPU= a > dedicated HPET comparator. Alternatively, you could add some special han= dling > where CPU 0 never goes into C2 or C3 but sends IPIs to other CPUs in deep= idle > states when necessary (you could also let CPU 0 fake statclock() for said= CPUs > as well perhaps). I see. In SMP environment, this seems to be very good. I'll try to implement next version by using HPET. 2010/3/31 Artem Belevich : > It may be worth it to look at Solaris' cyclic facillity for ideas. > sys/cddl/dev/cyclic/cyclic.c Thanks! I'll read it. 2010/3/31 Dag-Erling Sm=F8rgrav : >Never mind, Julian was making a joke at my expense. OK :D I wanna make next patch which is reflected your opinions by the end of April. Thank you! Very Truly yours Tsuyoshi Ozawa --=20 Tsuyoshi Ozawa