svn commit: r313352 - in head/sys: compat/cloudabi compat/freebsd32 compat/linux vm

Konstantin Belousov kostikbel at gmail.com
Tue Feb 7 15:28:53 UTC 2017


On Tue, Feb 07, 2017 at 02:50:15PM +0100, Mateusz Guzik wrote:
> Can we start dropping the td argument? It always is curthread and
> almost always has to be anyway as something down below accesses
> data in a manner only safe for curthread (classic: credential checks).
> 
> With this example the function takes 7 args. So the commit added an
> indirection which cannot be tail called on amd64 due to the 7th argument
> passed through the stack. Removing the td argument deals with the
> problem.

OTOH accessing current thread as curthread adds some number of instructions
with %gs prefixes.  On older machines, this caused bubbles in the frontend
decoding of the instructions, which made using plain pointer instead of the
magical curthread reasonable.  Modern big processors should not have the
problem anymore, but smaller designs like Atom still do.

I suspect it is quite hard to notice a difference there, either with %gs
decoding overhead, or with the missed tail call optimization, for the
vm syscalls which are quite slow on its own.  The effects of both micro-
optimizations should be noise.


More information about the svn-src-head mailing list