]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
rust: sync: atomic: Add generic atomics
authorBoqun Feng <boqun.feng@gmail.com>
Fri, 5 Sep 2025 04:41:31 +0000 (21:41 -0700)
committerPeter Zijlstra <peterz@infradead.org>
Mon, 15 Sep 2025 07:38:33 +0000 (09:38 +0200)
commit29c32c405e53605dfd24054a4460516f7f6e3938
tree7e2819f65f3f7f61e4b8d3d825956010ade1ce36
parentb638c9bc471030ebd898b57c5bf7c96f6d70cda4
rust: sync: atomic: Add generic atomics

To provide using LKMM atomics for Rust code, a generic `Atomic<T>` is
added, currently `T` needs to be Send + Copy because these are the
straightforward usages and all basic types support this.

Implement `AtomicType` for `i32` and `i64`, and so far only basic
operations load() and store() are introduced.

Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Benno Lossin <lossin@kernel.org>
Reviewed-by: Elle Rhumsaa <elle@weathered-steel.dev>
Link: https://lore.kernel.org/all/20250719030827.61357-5-boqun.feng@gmail.com/
rust/kernel/sync/atomic.rs
rust/kernel/sync/atomic/predefine.rs [new file with mode: 0644]