From owner-svn-src-all@FreeBSD.ORG Fri May 28 02:00:15 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AF08C106567A; Fri, 28 May 2010 02:00:15 +0000 (UTC) (envelope-from neel@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 85E778FC18; Fri, 28 May 2010 02:00:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4S20FRv050178; Fri, 28 May 2010 02:00:15 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4S20F0t050176; Fri, 28 May 2010 02:00:15 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201005280200.o4S20F0t050176@svn.freebsd.org> From: Neel Natu Date: Fri, 28 May 2010 02:00:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208607 - head/sys/mips/mips X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 May 2010 02:00:15 -0000 Author: neel Date: Fri May 28 02:00:15 2010 New Revision: 208607 URL: http://svn.freebsd.org/changeset/base/208607 Log: If 'timer2hz' is zero then we don't need to call 'timer2clock()' directly. It will be called automatically by 'timer1clock()'. Do profiling as often as possible by running it as the same frequency as 'timer1hz'. The statistics clock is run as close to 128Hz as possible. Pointed out by: mav@ Modified: head/sys/mips/mips/tick.c Modified: head/sys/mips/mips/tick.c ============================================================================== --- head/sys/mips/mips/tick.c Fri May 28 01:06:40 2010 (r208606) +++ head/sys/mips/mips/tick.c Fri May 28 02:00:15 2010 (r208607) @@ -127,9 +127,6 @@ void mips_timer_init_params(uint64_t platform_counter_freq, int double_count) { - stathz = hz; - profhz = hz; - /* * XXX: Do not use printf here: uart code 8250 may use DELAY so this * function should be called before cninit. @@ -143,6 +140,17 @@ mips_timer_init_params(uint64_t platform if (double_count != 0) counter_freq /= 2; + /* + * 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 timer + * (and profhz) run at hz. If 'hz' is below 1500 but above + * 750, then we let the timer run at 2 * 'hz'. If 'hz' + * is below 750 then we let the timer run at 4 * 'hz'. + */ if (hz >= 1500) timer1hz = hz; else if (hz >= 750) @@ -150,6 +158,12 @@ mips_timer_init_params(uint64_t platform else timer1hz = hz * 4; + if (timer1hz < 128) + stathz = timer1hz; + else + stathz = timer1hz / (timer1hz / 128); + profhz = timer1hz; + cycles_per_tick = counter_freq / timer1hz; cycles_per_usec = counter_freq / (1 * 1000 * 1000); @@ -285,7 +299,6 @@ clock_intr(void *arg) while (lost_ticks >= cycles_per_tick) { timer1clock(TRAPF_USERMODE(tf), tf->pc); - timer2clock(TRAPF_USERMODE(tf), tf->pc); lost_ticks -= cycles_per_tick; } DPCPU_SET(lost_ticks, lost_ticks); @@ -301,7 +314,6 @@ clock_intr(void *arg) (*cyclic_clock_func[cpu])(tf); #endif timer1clock(TRAPF_USERMODE(tf), tf->pc); - timer2clock(TRAPF_USERMODE(tf), tf->pc); critical_exit(); return (FILTER_HANDLED); }