linux-stable/kernel/futex
Linus Torvalds 43a43faf53 futex: improve user space accesses
Josh Poimboeuf reports that he got a "will-it-scale.per_process_ops 1.9%
improvement" report for his patch that changed __get_user() to use
pointer masking instead of the explicit speculation barrier.  However,
that patch doesn't actually work in the general case, because some (very
bad) architecture-specific code actually depends on __get_user() also
working on kernel addresses.

A profile showed that the offending __get_user() was the futex code,
which really should be fixed up to not use that horrid legacy case.
Rewrite futex_get_value_locked() to use the modern user acccess helpers,
and inline it so that the compiler not only avoids the function call for
a few instructions, but can do CSE on the address masking.

It also turns out the x86 futex functions have unnecessary barriers in
other places, so let's fix those up too.

Link: https://lore.kernel.org/all/20241115230653.hfvzyf3aqqntgp63@jpoimboe/
Reported-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-11-25 12:11:55 -08:00
..
core.c futex: improve user space accesses 2024-11-25 12:11:55 -08:00
futex.h futex: improve user space accesses 2024-11-25 12:11:55 -08:00
Makefile futex: Split out wait/wake 2021-10-07 13:51:11 +02:00
pi.c locking/mutex: Remove wakeups from under mutex::wait_lock 2024-10-14 12:52:40 +02:00
requeue.c plist: Split out plist_types.h 2023-12-20 19:26:31 -05:00
syscalls.c futex: make futex_parse_waitv() available as a helper 2023-09-29 02:37:05 -06:00
waitwake.c plist: Split out plist_types.h 2023-12-20 19:26:31 -05:00