From owner-freebsd-current@FreeBSD.ORG Thu Feb 9 22:32:20 2006 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C199216A420 for ; Thu, 9 Feb 2006 22:32:20 +0000 (GMT) (envelope-from phk@critter.freebsd.dk) Received: from pasmtp.tele.dk (pasmtp.tele.dk [193.162.159.95]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6810043D45 for ; Thu, 9 Feb 2006 22:32:20 +0000 (GMT) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (0x535c0e2a.sgnxx1.adsl-dhcp.tele.dk [83.92.14.42]) by pasmtp.tele.dk (Postfix) with ESMTP id 403B41EC303 for ; Thu, 9 Feb 2006 23:32:18 +0100 (CET) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.13.4/8.13.4) with ESMTP id k19MWIrB001836 for ; Thu, 9 Feb 2006 22:32:18 GMT (envelope-from phk@critter.freebsd.dk) To: current@freebsd.org From: Poul-Henning Kamp Date: Thu, 09 Feb 2006 22:32:18 +0000 Message-ID: <1835.1139524338@critter.freebsd.dk> Sender: phk@critter.freebsd.dk Cc: Subject: [TEST/REVIEW] cpu time accounting patch, step 2 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Feb 2006 22:32:20 -0000 http://phk.freebsd.dk/patch/cputime.patch This patch enables the new cpu time accounting method for i386 with TSC, all amd64 and sparc64 (?) and i386 with Geode cpu. The overall objective is to trade a minor amount of precision in cpu time accounting for a significant speedup in context switch. On my amd64 machine, I get 27+/-5 % improvement on unixbench/context1. Basically the patch uses the TSC or other (per-CPU) hardware device to keep track of CPU utilization and only converts to microseconds when necessary. If no "special" hardware is available the code falls back to the timecounter hardware, whatever it is. If the "special hardware" counter is marked as variable, a function runs every 16 seconds and (tries to) calibrate the max frequency we have ever seen. (If you boot verbose it will say what it does). This code is supposed to cope with laptops and other power-managed hardware. Only the "boot CPU" is calibrated, the other CPUs are supposed to run at the same rate (but they may have an offset). Tests, reviews etc please. Poul-Henning -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence.