From owner-freebsd-current@FreeBSD.ORG Mon Nov 28 22:11:29 2005 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 8331216A41F for ; Mon, 28 Nov 2005 22:11:29 +0000 (GMT) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.FreeBSD.org (Postfix) with ESMTP id F3F6243D68 for ; Mon, 28 Nov 2005 22:11:26 +0000 (GMT) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (unknown [192.168.48.2]) by phk.freebsd.dk (Postfix) with ESMTP id 0C3D6BC66 for ; Mon, 28 Nov 2005 22:11:24 +0000 (UTC) To: current@freebsd.org From: Poul-Henning Kamp Date: Mon, 28 Nov 2005 23:11:24 +0100 Message-ID: <6592.1133215884@critter.freebsd.dk> Sender: phk@critter.freebsd.dk Cc: Subject: proof-of-concept patch for cpu accounting speedup 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: Mon, 28 Nov 2005 22:11:29 -0000 http://phk.freebsd.dk/patch/context_time.patch This is just a proof of concept, it doesn't have all the tricky bits for determining max TSC rate on machines where the cpu clock is fiddled with and it doesn't have a fallback for machines without TSC etc etc. But in your average i386 (and probably amd64) system it should work. I am very interested to hear feedback and benchmarks of this patch. The two most critical measurements are: * "how does it affect workloads which do many context switches" and * "how does this affect CPU time accounting." To measure the latter, make absolutely sure your machine doesn't play power saving tricks with the TSC/cpu clock. A quick sanity check reveals no obvious bogons in cpu time accounting and unixbench's context1 switch shows 23% improvement on my testbox: x _reference + _patched +--------------------------------------------------------------------------+ |x xx x + ++ ++| | |_AM_| |____A___|| +--------------------------------------------------------------------------+ N Min Max Median Avg Stddev x 5 48370 49433 48997 48959.8 380.65693 + 5 59107 61079 60536 60376.4 786.45458 Difference at 95.0% confidence 11416.6 +/- 901.059 23.3183% +/- 1.84041% (Student's t, pooled s = 617.823) -- 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.