Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 09 Feb 2006 22:32:18 +0000
From:      Poul-Henning Kamp <phk@phk.freebsd.dk>
To:        current@freebsd.org
Subject:   [TEST/REVIEW] cpu time accounting patch, step 2
Message-ID:  <1835.1139524338@critter.freebsd.dk>

next in thread | raw e-mail | index | archive | help

	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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1835.1139524338>