mirror of
https://github.com/opnsense/src.git
synced 2026-06-13 10:40:19 -04:00
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
This commit is contained in:
parent
29a0621084
commit
19419d36cf
1 changed files with 1 additions and 0 deletions
|
|
@ -63,6 +63,7 @@ static int stub_getname_np(pthread_t, char *, size_t);
|
|||
#define PJT_DUAL_ENTRY(entry) \
|
||||
(pthread_func_t)entry, (pthread_func_t)entry
|
||||
|
||||
__attribute__((visibility("protected")))
|
||||
pthread_func_entry_t __thr_jtable[PJT_MAX] = {
|
||||
[PJT_ATFORK] = {PJT_DUAL_ENTRY(stub_zero)},
|
||||
[PJT_ATTR_DESTROY] = {PJT_DUAL_ENTRY(stub_zero)},
|
||||
|
|
|
|||
Loading…
Reference in a new issue