From owner-cvs-src@FreeBSD.ORG Tue Oct 2 18:53:50 2007 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6BECD16A54F; Tue, 2 Oct 2007 18:53:50 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from speedfactory.net (mail6.speedfactory.net [66.23.216.219]) by mx1.freebsd.org (Postfix) with ESMTP id B2FD913C474; Tue, 2 Oct 2007 18:53:49 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (unverified [66.23.211.162]) by speedfactory.net (SurgeMail 3.8p) with ESMTP id 212557712-1834499 for multiple; Tue, 02 Oct 2007 14:53:43 -0400 Received: from localhost.corp.yahoo.com (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.13.8/8.13.8) with ESMTP id l92IrT8l013068; Tue, 2 Oct 2007 14:53:33 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: Bruce Evans Date: Tue, 2 Oct 2007 14:43:38 -0400 User-Agent: KMail/1.9.6 References: <20071001145257.EC9FC4500F@ptavv.es.net> <20071001232743.Q539@10.0.0.1> <20071002213829.F12287@delplex.bde.org> In-Reply-To: <20071002213829.F12287@delplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200710021443.40264.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Tue, 02 Oct 2007 14:53:34 -0400 (EDT) X-Virus-Scanned: ClamAV version 0.88.3, clamav-milter version 0.88.3 on server.baldwin.cx X-Virus-Status: Clean Cc: src-committers@freebsd.org, Kevin Oberman , cvs-src@freebsd.org, Jeff Roberson , Garance A Drosehn , Ben Kaduk , cvs-all@freebsd.org, Jeff Roberson Subject: Re: cvs commit: src/sys/kern sched_ule.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Oct 2007 18:53:50 -0000 On Tuesday 02 October 2007 09:49:34 am Bruce Evans wrote: > Apparently, there is a scaling bug for hz or extra interrupts for > the larger hz help, and the default preempt_thresh is not best. -current on i386 and amd64 does a very poor job of scaling stathz and profhz with hz, so this may explain problems at hz=100. I have an attempt to make stathz and profhz more sane while also trying to not always drive the lapic timer at hz * 2. I used to have a test program that would display all the frequencies for different 'hz' values but have misplaced it. :( --- //depot/vendor/freebsd/src/sys/amd64/amd64/local_apic.c 2007/09/11 22:57:37 +++ //depot/user/jhb/acpipci/amd64/amd64/local_apic.c 2007/09/24 17:24:13 @@ -72,8 +72,6 @@ CTASSERT(IPI_STOP < APIC_SPURIOUS_INT); #define LAPIC_TIMER_HZ_DIVIDER 2 -#define LAPIC_TIMER_STATHZ_DIVIDER 15 -#define LAPIC_TIMER_PROFHZ_DIVIDER 3 /* Magic IRQ values for the timer and syscalls. */ #define IRQ_TIMER (NUM_IO_INTS + 1) @@ -383,13 +381,24 @@ lapic_timer_divisor, value); /* - * We will drive the timer at a small multiple of hz and drive - * both of the other timers with similarly small but relatively - * prime divisors. + * We want to run stathz in the neighborhood of 128hz. We would + * like profhz to run as often as possible, so we let it run on + * each clock tick. We try to honor the requested 'hz' value as + * much as possible. + * + * If 'hz' is above 1500, then we just let the lapic timer + * (and profhz) run at hz. If 'hz' is below 1500 but above + * 750, then we let the lapic timer run at 2 * 'hz'. If 'hz' + * is below 750 then we let the lapic timer run at 4 * 'hz'. */ - lapic_timer_hz = hz * LAPIC_TIMER_HZ_DIVIDER; - stathz = lapic_timer_hz / LAPIC_TIMER_STATHZ_DIVIDER; - profhz = lapic_timer_hz / LAPIC_TIMER_PROFHZ_DIVIDER; + if (hz >= 1500) + lapic_timer_hz = hz; + else if (hz >= 750) + lapic_timer_hz = hz * 2; + else + lapic_timer_hz = hz * 4; + stathz = lapic_timer_hz / (lapic_timer_hz * 128); + profhz = lapic_timer_hz; lapic_timer_period = value / lapic_timer_hz; /* --- //depot/vendor/freebsd/src/sys/i386/i386/local_apic.c 2007/09/11 22:57:37 +++ //depot/user/jhb/acpipci/i386/i386/local_apic.c 2007/09/24 17:24:13 @@ -72,8 +72,6 @@ CTASSERT(IPI_STOP < APIC_SPURIOUS_INT); #define LAPIC_TIMER_HZ_DIVIDER 2 -#define LAPIC_TIMER_STATHZ_DIVIDER 15 -#define LAPIC_TIMER_PROFHZ_DIVIDER 3 /* Magic IRQ values for the timer and syscalls. */ #define IRQ_TIMER (NUM_IO_INTS + 1) @@ -385,13 +383,24 @@ lapic_timer_divisor, value); /* - * We will drive the timer at a small multiple of hz and drive - * both of the other timers with similarly small but relatively - * prime divisors. + * We want to run stathz in the neighborhood of 128hz. We would + * like profhz to run as often as possible, so we let it run on + * each clock tick. We try to honor the requested 'hz' value as + * much as possible. + * + * If 'hz' is above 1500, then we just let the lapic timer + * (and profhz) run at hz. If 'hz' is below 1500 but above + * 750, then we let the lapic timer run at 2 * 'hz'. If 'hz' + * is below 750 then we let the lapic timer run at 4 * 'hz'. */ - lapic_timer_hz = hz * LAPIC_TIMER_HZ_DIVIDER; - stathz = lapic_timer_hz / LAPIC_TIMER_STATHZ_DIVIDER; - profhz = lapic_timer_hz / LAPIC_TIMER_PROFHZ_DIVIDER; + if (hz >= 1500) + lapic_timer_hz = hz; + else if (hz >= 750) + lapic_timer_hz = hz * 2; + else + lapic_timer_hz = hz * 4; + stathz = lapic_timer_hz / (lapic_timer_hz * 128); + profhz = lapic_timer_hz; lapic_timer_period = value / lapic_timer_hz; /* -- John Baldwin