]> sourceware.org Git - glibc.git/commit
Linux: Use rseq in sched_getcpu if available
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 6 Jul 2020 08:21:31 +0000 (10:21 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Mon, 6 Jul 2020 08:21:32 +0000 (10:21 +0200)
commit6e29cb3f61ff5432c78a1c84b0d9b123a350ab36
tree64123a1c9f0e8b7e6ef41f9910449065c6942022
parent0c76fc3c2b346dc5401dc055d97d4279632b0fb3
Linux: Use rseq in sched_getcpu if available

When available, use the cpu_id field from __rseq_abi on Linux to
implement sched_getcpu().  Fall-back on the vgetcpu vDSO if unavailable.

Benchmarks:

x86-64: Intel E5-2630 v3@2.40GHz, 16-core, hyperthreading

glibc sched_getcpu():                     13.7 ns (baseline)
glibc sched_getcpu() using rseq:           2.5 ns (speedup:  5.5x)
inline load cpuid from __rseq_abi TLS:     0.8 ns (speedup: 17.1x)
sysdeps/unix/sysv/linux/sched_getcpu.c
This page took 0.037973 seconds and 5 git commands to generate.