mirror of
https://github.com/torvalds/linux.git
synced 2026-11-29 10:07:52 +00:00
Memory barriers are building blocks for concurrent code, hence provide a minimal set of them. The compiler barrier, barrier(), is implemented in inline asm instead of using core::sync::atomic::compiler_fence() because memory models are different: kernel's atomics are implemented in inline asm therefore the compiler barrier should be implemented in inline asm as well. Also it's currently only public to the kernel crate until there's a reasonable driver usage. Signed-off-by: Boqun Feng <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Alice Ryhl <[email protected]> Reviewed-by: Elle Rhumsaa <[email protected]> Link: https://lore.kernel.org/all/[email protected]/
19 lines
204 B
C
19 lines
204 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
#include <asm/barrier.h>
|
|
|
|
void rust_helper_smp_mb(void)
|
|
{
|
|
smp_mb();
|
|
}
|
|
|
|
void rust_helper_smp_wmb(void)
|
|
{
|
|
smp_wmb();
|
|
}
|
|
|
|
void rust_helper_smp_rmb(void)
|
|
{
|
|
smp_rmb();
|
|
}
|