Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Feb 2017 17:28:48 +0200
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Mateusz Guzik <mjguzik@gmail.com>
Cc:        Edward Tomasz Napierala <trasz@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r313352 - in head/sys: compat/cloudabi compat/freebsd32 compat/linux vm
Message-ID:  <20170207152848.GC2092@kib.kiev.ua>
In-Reply-To: <20170207135014.GC4772@dft-labs.eu>
References:  <201702062057.v16KvCtI069664@repo.freebsd.org> <20170207135014.GC4772@dft-labs.eu>

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



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