Re: [PATCH v3 1/4] futex: Implement mechanism to wait on any of several futexes

From: Peter Zijlstra
Date: Fri Feb 28 2020 - 14:50:13 EST


On Fri, Feb 28, 2020 at 08:07:17PM +0100, Peter Zijlstra wrote:
> On Thu, Feb 13, 2020 at 06:45:22PM -0300, André Almeida wrote:
> > @@ -150,4 +153,21 @@ struct robust_list_head {
> > (((op & 0xf) << 28) | ((cmp & 0xf) << 24) \
> > | ((oparg & 0xfff) << 12) | (cmparg & 0xfff))
> >
> > +/*
> > + * Maximum number of multiple futexes to wait for
> > + */
> > +#define FUTEX_MULTIPLE_MAX_COUNT 128
> > +
> > +/**
> > + * struct futex_wait_block - Block of futexes to be waited for
> > + * @uaddr: User address of the futex
> > + * @val: Futex value expected by userspace
> > + * @bitset: Bitset for the optional bitmasked wakeup
> > + */
> > +struct futex_wait_block {
> > + __u32 __user *uaddr;
> > + __u32 val;
> > + __u32 bitset;
> > +};
>
> So I have a problem with this vector layout, it doesn't allow for
> per-futex flags, and esp. with that multi-size futex support that
> becomes important, but also with the already extand private/shared and
> wait_bitset flags this means you cannot have a vector with mixed wait
> types.

Alternatively, we throw the entire single-syscall futex interface under
the bus and design a bunch of new syscalls that are natively vectored or
something.

Thomas mentioned something like that, the problem is, ofcourse, that we
then want to fix a whole bunch of historical ills, and the probmem
becomes much bigger.

Thomas?