Re: [PATCH v12 21/21] selftests/futex: Add futex_numa_mpol
From: Peter Zijlstra
Date: Fri May 02 2025 - 15:16:21 EST
On Wed, Apr 16, 2025 at 06:29:21PM +0200, Sebastian Andrzej Siewior wrote:
> diff --git a/tools/testing/selftests/futex/include/futex2test.h b/tools/testing/selftests/futex/include/futex2test.h
> index 9d305520e849b..b664e8f92bfd7 100644
> --- a/tools/testing/selftests/futex/include/futex2test.h
> +++ b/tools/testing/selftests/futex/include/futex2test.h
> @@ -8,6 +8,11 @@
>
> #define u64_to_ptr(x) ((void *)(uintptr_t)(x))
>
> +struct futex32_numa {
> + futex_t futex;
> + futex_t numa;
> +};
> +
> /**
> * futex_waitv - Wait at multiple futexes, wake on any
> * @waiters: Array of waiters
> @@ -20,3 +25,32 @@ static inline int futex_waitv(volatile struct futex_waitv *waiters, unsigned lon
> {
> return syscall(__NR_futex_waitv, waiters, nr_waiters, flags, timo, clockid);
> }
> +
> +static inline int futex2_wait(volatile struct futex_waitv *waiters, unsigned long nr_waiters,
> + unsigned long flags, struct timespec *timo, clockid_t clockid)
> +{
> + return syscall(__NR_futex_waitv, waiters, nr_waiters, flags, timo, clockid);
> +}
So this one seemed unused, deleted it and
> +/*
> + * futex_wait2() - block on uaddr with optional timeout
> + * @val: Expected value
> + * @flags: FUTEX2 flags
> + * @timeout: Relative timeout
> + * @clockid: Clock id for the timeout
> + */
> +static inline int futex2_wait2(void *uaddr, long val, unsigned int flags,
> + struct timespec *timeout, clockid_t clockid)
> +{
> + return syscall(__NR_futex_wait, uaddr, val, 1, flags, timeout, clockid);
> +}
renamed this one.
> +/*
> + * futex2_wake() - Wake a number of futexes
> + * @nr: Number of threads to wake at most
> + * @flags: FUTEX2 flags
> + */
> +static inline int futex2_wake(void *uaddr, int nr, unsigned int flags)
> +{
> + return syscall(__NR_futex_wake, uaddr, 1, nr, flags);
> +}
Next question; you're setting bitmask to 1 instead of
FUTEX_BITSET_MATCH_ANY, which is the default value.
I'm going to make it ~0U unless you have a reason for this 1.