]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
uaccess: Provide unsafe_atomic_store_release_user()
authorThomas Gleixner <tglx@kernel.org>
Tue, 2 Jun 2026 09:09:42 +0000 (11:09 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Wed, 3 Jun 2026 09:38:50 +0000 (11:38 +0200)
commit6149fc36c09b91050b62e8e68a91027df8df7345
tree3b5e75f60ab755a2f8ef50d863c1cd7c6f225730
parent2cb5251d3d64d57c172185b9b608f704b3015f26
uaccess: Provide unsafe_atomic_store_release_user()

The upcoming support for unlocking robust futexes in the kernel requires
store release semantics. Syscalls do not imply memory ordering on all
architectures so the unlock operation requires a barrier.

This barrier can be avoided when stores imply release like on x86.

Provide a generic version with a smp_mb() before the unsafe_put_user(),
which can be overridden by architectures.

Provide also a ARCH_MEMORY_ORDER_TSO Kconfig option, which can be selected
by architectures with Total Store Order (TSO), where store implies release,
so that the smp_mb() in the generic implementation can be avoided.

If that is set a barrier() is used instead of smp_mb(), which is not
required for the use case at hand, but makes it future proof for other
usage to prevent the compiler from reordering.

Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: André Almeida <andrealmeid@igalia.com>
Link: https://patch.msgid.link/20260602090535.513181528@kernel.org
arch/Kconfig
include/linux/uaccess.h