From owner-cvs-src@FreeBSD.ORG Tue Oct 18 13:44:11 2005 Return-Path: X-Original-To: cvs-src@FreeBSD.org Delivered-To: cvs-src@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5EA1C16A41F; Tue, 18 Oct 2005 13:44:11 +0000 (GMT) (envelope-from gallatin@cs.duke.edu) Received: from duke.cs.duke.edu (duke.cs.duke.edu [152.3.140.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id E284C43D45; Tue, 18 Oct 2005 13:44:08 +0000 (GMT) (envelope-from gallatin@cs.duke.edu) Received: from grasshopper.cs.duke.edu (grasshopper.cs.duke.edu [152.3.145.30]) by duke.cs.duke.edu (8.13.4/8.13.4) with ESMTP id j9IDi7bF004865 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 18 Oct 2005 09:44:07 -0400 (EDT) Received: (from gallatin@localhost) by grasshopper.cs.duke.edu (8.12.9p2/8.12.9/Submit) id j9IDi2rC029214; Tue, 18 Oct 2005 09:44:02 -0400 (EDT) (envelope-from gallatin) Date: Tue, 18 Oct 2005 09:44:02 -0400 From: Andrew Gallatin To: David Xu Message-ID: <20051018094402.A29138@grasshopper.cs.duke.edu> References: <200510172310.j9HNAVPL013057@repoman.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200510172310.j9HNAVPL013057@repoman.freebsd.org>; from davidxu@FreeBSD.org on Mon, Oct 17, 2005 at 11:10:31PM +0000 X-Operating-System: FreeBSD 4.9-RELEASE-p1 on an i386 Cc: cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/amd64/amd64 cpu_switch.S machdep.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, 18 Oct 2005 13:44:11 -0000 David Xu [davidxu@FreeBSD.org] wrote: > davidxu 2005-10-17 23:10:31 UTC > > FreeBSD src repository > > Modified files: > sys/amd64/amd64 cpu_switch.S machdep.c > Log: > Micro optimization for context switch. Eliminate code for saving gs.base > and fs.base. We always update pcb.pcb_gsbase and pcb.pcb_fsbase > when user wants to set them, in context switch routine, we only need to > write them into registers, we never have to read them out from registers > when thread is switched away. Since rdmsr is a serialization instruction, > micro benchmark shows it is worthy to do. Nice. This reduces lmbench context switch latency by about 0.4us (7.2 -> 6.8us), and reduces TCP loopback latency by about 0.9us (36.1 -> 35.2) on my dual core 3800+ It is a shame we can't find a way to use the TSC as a timecounter on SMP systems. It seems that about 40% of the context switch time is spent just waiting for the PIO read of the ACPI-fast or i8254 to return. Drew