[RFC][PATCH 00/10] futex: More Futex2 bits
From: Peter Zijlstra
Date: Fri Jul 14 2023 - 10:16:41 EST
Hi,
Reviewing Jens' series to add io_uring futex support got me looking at futex
again, and I realized the current flags situation is a mess. After cleaning
that up I decided to continue and implement most of the missing flags for
futex2.
I initially also wanted to add a futex_wait() syscall, but given the amount and
kind of arguments that needs, that's just not going to work on 32bit.
futex_waitv() will have to do for now.
I've not yet done futex_requeue(), that's even worse than futex_wait() and I
think the only option is to do something like:
sys_futex_requeue(struct futex_waitv __user futexes[2], unsigned int flags, int nr_wake, int nr_requeue)
Where we use struct futex_wativ to specify the two futexes (addr and flags) and
cmp value.
Additionally, robust futexes can fundamentally only support 32bit unless we go
make more lists.
The 'small' futex support is very limited, esp. when combined with FUTEX2_NUMA
mixing sizes is really not an option. The requeue variant above would be able
to specify different sizes for each futex and might just do.
The whole series is *very* lightly tested, as in, it builds and boots, but I've
not yet written a single line of user code to trigger any of the new paths.
Please handle with care etc.. ;-)
Jens, given you do a completely new futex interface, it probably makes more
sense if you use FUTEX2 flags and a u64 value and mask.
I'm hoping this series clarifies that situation a little instead of making it a
worse mess. Many of these things have been brewing over the past several years
but nobody put it all together before.