From owner-freebsd-threads@FreeBSD.ORG Tue Jun 8 01:44:01 2004 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8D7E616A4CE; Tue, 8 Jun 2004 01:44:01 +0000 (GMT) Received: from smtp01.syd.iprimus.net.au (smtp01.syd.iprimus.net.au [210.50.30.52]) by mx1.FreeBSD.org (Postfix) with ESMTP id F27ED43D1D; Tue, 8 Jun 2004 01:43:58 +0000 (GMT) (envelope-from tim@robbins.dropbear.id.au) Received: from robbins.dropbear.id.au (210.50.200.253) by smtp01.syd.iprimus.net.au (7.0.024) id 40B7A0DA002E51BD; Tue, 8 Jun 2004 11:43:57 +1000 Received: by robbins.dropbear.id.au (Postfix, from userid 1000) id 8320B41D0; Tue, 8 Jun 2004 11:45:44 +1000 (EST) Date: Tue, 8 Jun 2004 11:45:44 +1000 From: Tim Robbins To: David Xu Message-ID: <20040608014544.GA43197@cat.robbins.dropbear.id.au> References: <20040607215054.GA41798@cat.robbins.dropbear.id.au> <40C51203.8050508@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <40C51203.8050508@freebsd.org> User-Agent: Mutt/1.4.1i cc: freebsd-amd64@freebsd.org cc: freebsd-threads@freebsd.org Subject: Re: [tjr@FreeBSD.org: cvs commit: src/lib/libpthread/arch/amd64/amd64 context.S] X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Jun 2004 01:44:01 -0000 On Tue, Jun 08, 2004 at 09:10:27AM +0800, David Xu wrote: > Is there any reason to use memory indirect jump ? did you > have benchmarked context switch speed before and after this commit ? > I won't use such indirect jump in speed sensitive case, it is > not CPU branch trace cache friendly, it is better to use > ret to match call in up level. For the reason Peter mentioned, we can't use "ret" in the general case. It may be possible to do it that way for voluntary/synchronous context switches, but it's probably not worth the effort -- even the i386 context switch functions have not been micro-optimised to this level: they save scratch registers + flags, perform redundant null pointer checks, validate mc_len, initialise and save the FPU control word for threads that don't touch the FPU, perform unaligned jumps, etc. etc. As for benchmarks: the new version runs Mozilla infinitely faster :-) Tim