From owner-freebsd-hackers@FreeBSD.ORG Tue Mar 30 13:39:06 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 C7F4F106566B for ; Tue, 30 Mar 2010 13:39:06 +0000 (UTC) (envelope-from ozawa@t-oza.net) Received: from ey-out-2122.google.com (ey-out-2122.google.com [74.125.78.24]) by mx1.freebsd.org (Postfix) with ESMTP id 6771C8FC19 for ; Tue, 30 Mar 2010 13:39:05 +0000 (UTC) Received: by ey-out-2122.google.com with SMTP id d26so891374eyd.9 for ; Tue, 30 Mar 2010 06:39:05 -0700 (PDT) MIME-Version: 1.0 Sender: ozawa@t-oza.net Received: by 10.216.171.65 with HTTP; Tue, 30 Mar 2010 06:39:04 -0700 (PDT) X-Originating-IP: [59.86.1.16] In-Reply-To: <411a180c1003300537g2a1b4879u2d8d952ce9977cb5@mail.gmail.com> References: <411a180c1003300537g2a1b4879u2d8d952ce9977cb5@mail.gmail.com> Date: Tue, 30 Mar 2010 05:39:04 -0800 X-Google-Sender-Auth: efba39ebce25f683 Received: by 10.216.86.200 with SMTP id w50mr1535017wee.173.1269956344369; Tue, 30 Mar 2010 06:39:04 -0700 (PDT) Message-ID: <411a180c1003300639l13d33451q305a61b2bcd6e3d5@mail.gmail.com> From: Tsuyoshi Ozawa To: freebsd-hackers Content-Type: text/plain; charset=ISO-8859-1 Subject: 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: Tue, 30 Mar 2010 13:39:06 -0000 Hello, I started to work dynamic ticks in FreeBSD, and now experimental code start to work roughly. The code is here : http://github.com/oza/FreeBSD-8.0-dyntick The timer interrupt handler works as follows : 1. Scan callout queue and get when the timer fire. This is the value we can skip. 2. Run hardware timer in "oneshot mode" instead of periodic mode. My experimental code only work for local apic timer. After translating the value which is gotten at 1 to local apic timer count, pass the value to local apic timer. 3. Exit timer interrupt handler. My experimental code needs a kernel module to switch to dynamic tick mode. The kernel module is here : http://gist.github.com/345917 The benchmark is here : http://tsuyoshiozawa.blogspot.com/2010/03/started-to-implement-dynticks-in.html The result says that dynticks can save CPU power significantly, so this worth to work. But this is incomplete to work kernel components correctly. There are a lot of problems: 1. The global variable "ticks" isn't incremented by 2 and above. This gets worse the response. 2. To fix problem 1, I have to hack scheduler and profiler. If I do 1, these kernel component doesn't work correctly. But 2. is very expensive to implement. I think that it's good to switch between periodic ticks mode and dynamic ticks mode when isched_idletd is scheduled. So I'm planning to do this as a next step. If you have some idea or question about this work, please let me know. Thank you! Very truly yours Tsuyoshi Ozawa