Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Jun 2004 11:45:44 +1000
From:      Tim Robbins <tjr@freebsd.org>
To:        David Xu <davidxu@freebsd.org>
Cc:        freebsd-threads@freebsd.org
Subject:   Re: [tjr@FreeBSD.org: cvs commit: src/lib/libpthread/arch/amd64/amd64 context.S]
Message-ID:  <20040608014544.GA43197@cat.robbins.dropbear.id.au>
In-Reply-To: <40C51203.8050508@freebsd.org>
References:  <20040607215054.GA41798@cat.robbins.dropbear.id.au> <40C51203.8050508@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



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