diff options
| author | babenko <[email protected]> | 2026-06-14 18:52:20 +0300 |
|---|---|---|
| committer | babenko <[email protected]> | 2026-06-14 19:17:43 +0300 |
| commit | 52f00b11c4259dfa810ecdcba576a801dd043a87 (patch) | |
| tree | e5d7550d8387b03d9a862a2a4a76968da0e33853 /contrib/python/python-dateutil/py2/tests/_common.py | |
| parent | e68d615f34b4fd7d9b7309efa15366c6136d5bf9 (diff) | |
Fix rseq fast path on glibc < 2.35: read the shared __rseq_abi area
The own-area approach did not deliver the fast path on glibc 2.31 (YT's current
runtime). There tcmalloc registers the conventional `__rseq_abi` area for every
thread; our attempt to register a separate area was rejected by the kernel with
EINVAL (a thread may have only one rseq area), so `cpu_id` stayed -1 and every
`GetCurrentCpuId()` fell back to `sched_getcpu()` (~17-20 ns, slower than the
rdtscp it replaced).
Read the shared `__rseq_abi` symbol instead -- the area tcmalloc, librseq and
pre-2.35 glibc all register. Our definition is weak, so it coalesces with theirs
when present (the common case -- tcmalloc owns it) and stands alone otherwise
(e.g. musl), with us registering it. We register with the conventional signature
`0x53053053` and size 32, so re-registering an already-registered area returns
EBUSY (treated as success) rather than EINVAL -- coexisting cleanly with tcmalloc.
glibc >= 2.35 still takes the `__rseq_offset` path unchanged.
Measured on sas2-2769 (glibc 2.31 + tcmalloc): `GetCurrentCpuId()` 20.0 ns -> 0.60 ns,
verified via strace that our registration now returns EBUSY against tcmalloc's
`__rseq_abi` (was EINVAL against a separate area).
commit_hash:509809deeb5f7c671817fcd9ebcc8499eabf096e
Diffstat (limited to 'contrib/python/python-dateutil/py2/tests/_common.py')
0 files changed, 0 insertions, 0 deletions
