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

From: Florian Weimer
Date: Wed May 20 2020 - 06:14:52 EST


* Mathieu Desnoyers via Libc-alpha:

> diff --git a/sysdeps/unix/sysv/linux/sched_getcpu.c b/sysdeps/unix/sysv/linux/sched_getcpu.c
> index c019cfb3cf..2269c4f2bd 100644
> --- a/sysdeps/unix/sysv/linux/sched_getcpu.c
> +++ b/sysdeps/unix/sysv/linux/sched_getcpu.c
> @@ -18,10 +18,15 @@
> #include <errno.h>
> #include <sched.h>
> #include <sysdep.h>
> +#include <atomic.h>
> #include <sysdep-vdso.h>
>
> -int
> -sched_getcpu (void)
> +#ifdef HAVE_GETCPU_VSYSCALL
> +# define HAVE_VSYSCALL
> +#endif

I think the #ifdef is a result of an incorrect merge of commit
d0def09ff6bbf1537beec305fdfe96a21174fb31 ("linux: Fix vDSO macros build
with time64 interfaces") and it should be removed.

The commit subject should probably say âLinux: Use rseq in sched_getcpu
if availableâ.

Thanks,
Florian