Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sat, 16 May 2015 02:19:33 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: Eliminating preference for avoiding thread pointer? Cost
 on MIPS?

On Fri, May 15, 2015 at 11:55:44PM -0400, Rich Felker wrote:
> Traditionally, musl has gone to pretty great lengths to avoid
> depending on the thread pointer. The original reason was that it was
> not always initialized, and when it was, the init was lazy. This
> resulted in a lot of cruft, where we would have lots of constructs of
> the form:
> 
> 	bar = some_predicate ? __pthread_self()->foo : global_foo
> 
> or similar. Being that these predicates depend(ed) on globals, they
> were/are rather expensive in position-independent code on most archs.
> Now that the thread pointer is always initialized at startup (since
> 1.1.0) and assumed to have succeeded (since 1.1.9; musl now performs
> HCF if it fails), this seems to be an unnecessary cost. Not only does
> it cost cycles; it also has a complexity cost in terms of code to
> maintain the state of the predicates (e.g. the atomics for locale
> state) and in terms of libc-internal assumptions. So I'd like to just
> use the thread pointer directly wherever it makes sense, and take
> advantage of the fact that we have it.
> 
> [...]
> 
> So I think, whatever the performance results end up being, we have an
> acceptable path forward to use the (possibly virtual) thread pointer
> unconditionally throughout musl.

Just committed the first stage of this work:

http://git.musl-libc.org/cgit/musl/commit/?id=68630b55c0c7219fe9df70dc28ffbf9efc8021d8

If there are old-MIPS performance regressions we'll fix them at the
arch level rather than keeping this cruft all over the source.

Rich

Powered by blists - more mailing lists

Your e-mail address:

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.