mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-11-27 01:11:31 +00:00
23 lines
738 B
Rust
23 lines
738 B
Rust
|
|
// SPDX-License-Identifier: GPL-2.0
|
||
|
|
|
||
|
|
//! Atomic primitives.
|
||
|
|
//!
|
||
|
|
//! These primitives have the same semantics as their C counterparts: and the precise definitions of
|
||
|
|
//! semantics can be found at [`LKMM`]. Note that Linux Kernel Memory (Consistency) Model is the
|
||
|
|
//! only model for Rust code in kernel, and Rust's own atomics should be avoided.
|
||
|
|
//!
|
||
|
|
//! # Data races
|
||
|
|
//!
|
||
|
|
//! [`LKMM`] atomics have different rules regarding data races:
|
||
|
|
//!
|
||
|
|
//! - A normal write from C side is treated as an atomic write if
|
||
|
|
//! CONFIG_KCSAN_ASSUME_PLAIN_WRITES_ATOMIC=y.
|
||
|
|
//! - Mixed-size atomic accesses don't cause data races.
|
||
|
|
//!
|
||
|
|
//! [`LKMM`]: srctree/tools/memory-model/
|
||
|
|
|
||
|
|
#[allow(dead_code, unreachable_pub)]
|
||
|
|
mod internal;
|
||
|
|
|
||
|
|
pub use internal::AtomicImpl;
|