diff mbox series

[v1,1/6] Linux: Add FUTEX_LOCK_PI2

Message ID 20210625081104.1134598-2-kurt@linutronix.de
State New
Headers show
Series nptl: Introduce and use FUTEX_LOCK_PI2 | expand

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

Kurt Kanzenbach June 25, 2021, 8:10 a.m. UTC
Linux v5.14.0 introduced a new futex operation called FUTEX_LOCK_PI2.

This kernel feature can be used to implement
pthread_mutex_clocklock(MONOTONIC)/PI.

Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
---
 sysdeps/unix/sysv/linux/kernel-features.h | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Adhemerval Zanella July 9, 2021, 1:32 p.m. UTC | #1
On 25/06/2021 05:10, Kurt Kanzenbach wrote:
> Linux v5.14.0 introduced a new futex operation called FUTEX_LOCK_PI2.
> 
> This kernel feature can be used to implement
> pthread_mutex_clocklock(MONOTONIC)/PI.
> 
> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>

The __LINUX_KERNEL_VERSION looks fine now.

You will need to check with Carlos O'Donell if this is suitable for 2.34.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/unix/sysv/linux/kernel-features.h | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
> index 1680b10ca1b6..af4b2b304715 100644
> --- a/sysdeps/unix/sysv/linux/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/kernel-features.h
> @@ -218,4 +218,12 @@
>  # define __ASSUME_FACCESSAT2 0
>  #endif
>  
> +/* The FUTEX_LOCK_PI2 operation was introduced across all architectures in Linux
> +   5.14.  */
> +#if __LINUX_KERNEL_VERSION >= 0x050e00
> +# define __ASSUME_FUTEX_LOCK_PI2 1
> +#else
> +# define __ASSUME_FUTEX_LOCK_PI2 0
> +#endif
> +
>  #endif /* kernel-features.h */
>
diff mbox series

Patch

diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index 1680b10ca1b6..af4b2b304715 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -218,4 +218,12 @@ 
 # define __ASSUME_FACCESSAT2 0
 #endif
 
+/* The FUTEX_LOCK_PI2 operation was introduced across all architectures in Linux
+   5.14.  */
+#if __LINUX_KERNEL_VERSION >= 0x050e00
+# define __ASSUME_FUTEX_LOCK_PI2 1
+#else
+# define __ASSUME_FUTEX_LOCK_PI2 0
+#endif
+
 #endif /* kernel-features.h */