Skip to content

RFC futex: More Futex2 bits

Peter Zijlstra linux-api linux-arch linux-mm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest10 patches 8 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10futex: Clarify FUTEX2 flagsinclude/uapi/linux/futex.h kernel/futex/syscalls.c+16 -70 replies
2/10futex: Extend the FUTEX2 flagsinclude/uapi/linux/futex.h kernel/futex/syscalls.c+6 -50 replies
3/10futex: Flag conversionkernel/futex/futex.h kernel/futex/syscalls.c kernel/futex/waitwake.c+60 -130 replies
4/10futex: Add sys_futex_wake()arch/alpha/kernel/syscalls/syscall.tbl arch/arm/tools/syscall.tbl arch/arm64/include/asm/unistd32.h +18 more+62 -23 replies
5/10mm: Add vmalloc_huge_node()include/linux/vmalloc.h mm/vmalloc.c+9 -34 replies
6/10futex: Propagate flags into get_futex_key()kernel/futex/core.c kernel/futex/futex.h kernel/futex/pi.c +2 more+18 -140 replies
7/10futex: Implement FUTEX2_NUMAinclude/linux/futex.h kernel/futex/core.c kernel/futex/futex.h +1 more+107 -251 reply
8/10futex: Propagate flags into futex_get_value_locked()kernel/futex/core.c kernel/futex/futex.h kernel/futex/pi.c +2 more+11 -110 replies
9/10futex: Enable FUTEX2_{8,16}include/linux/futex.h kernel/futex/syscalls.c kernel/futex/waitwake.c+10 -90 replies
10/10futex: Munge size and numa into the legacy interfaceinclude/uapi/linux/futex.h kernel/futex/futex.h kernel/futex/syscalls.c+38 -40 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC][PATCH 00/10] futex: More Futex2 bits

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.