HomeFreeBSD

libc: Give __thr_jtable protected visibility

Description

libc: Give __thr_jtable protected visibility

This function pointer table is overwritten by libthr when it's loaded.
libc's pthread stubs are implemented by looking up an entry in this
table and invoking the function pointer contained in the entry.

pthread calls are fairly expensive even when libthr is not loaded: each
call involves indirection through the PLT, then through the GOT to look
up thr_jtable, then the function pointer itself. We can however
eliminate one level of indirection by disallowing preemption of the
thr_jtable symbol, and since the existence table is an internal
implementation detail, disabling preemption is unlikely to break
anything. This gives a modest improvement in some microbenchmarks which
call libc's pthread stubs.

Reviewed by: kib
MFC after: 1 month
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D50354

Details

Provenance
markjAuthored on May 19 2025, 2:29 PM
Reviewer
kib
Differential Revision
D50354: libc: Give __thr_jtable protected visibility
Parents
rG29a062108405: tcp: allow connections to IPv6 anycast address
Branches
Unknown
Tags
Unknown