Re: [PATCH 2/5] glibc: sched_getcpu(): use rseq cpu_id TLS on Linux (v2)

2019-04-18 Thread Mathieu Desnoyers
- On Apr 18, 2019, at 11:33 AM, Szabolcs Nagy szabolcs.n...@arm.com wrote: > On 16/04/2019 18:32, Mathieu Desnoyers wrote: >> --- a/sysdeps/unix/sysv/linux/sched_getcpu.c >> +++ b/sysdeps/unix/sysv/linux/sched_getcpu.c >> @@ -37,3 +37,26 @@ sched_getcpu (void) >>return -1; >> #endif >> }

Re: [PATCH 2/5] glibc: sched_getcpu(): use rseq cpu_id TLS on Linux (v2)

2019-04-18 Thread Szabolcs Nagy
On 16/04/2019 18:32, Mathieu Desnoyers wrote: > --- a/sysdeps/unix/sysv/linux/sched_getcpu.c > +++ b/sysdeps/unix/sysv/linux/sched_getcpu.c > @@ -37,3 +37,26 @@ sched_getcpu (void) >return -1; > #endif > } > + > +#ifdef __NR_rseq > +#include > +#endif > + > +#if defined __NR_rseq && defined

[PATCH 2/5] glibc: sched_getcpu(): use rseq cpu_id TLS on Linux (v2)

2019-04-16 Thread Mathieu Desnoyers
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 r