Re: [PATCH v12 21/21] selftests/futex: Add futex_numa_mpol
From: Sebastian Andrzej Siewior
Date: Mon May 05 2025 - 03:33:51 EST
On 2025-05-02 21:08:38 [+0200], Peter Zijlstra wrote:
> 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);
>
> I'm confused, sure this should be __NR_futex_wait
>
> > +}
> > +
> > +/*
> > + * 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)
>
> And this should be futex2_wait().
Yes. I didn't want to change it right away but yes. There already is a
futex2_wait() which uses the waitv syscall.
>
> > +{
> > + return syscall(__NR_futex_wait, uaddr, val, 1, flags, timeout, clockid);
> > +}
> > +
> > +/*
> > + * 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);
> > +}
Sebastian