Re: [PATCH v5 03/10] rust: sync: atomic: Add ordering annotation types
Peter Zijlstra <[email protected]>
| Newsgroups | dev.linux.lists.lkmm,org.kernel.vger.linux-arch,org.kernel.vger.linux-kernel,org.kernel.vger.rust-for-linux |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Jun 18, 2025 at 09:49:27AM -0700, Boqun Feng wrote: > +//! Memory orderings. > +//! > +//! The semantics of these orderings follows the [`LKMM`] definitions and rules. > +//! > +//! - [`Acquire`] and [`Release`] are similar to their counterpart in Rust memory model. So I've no clue what the Rust memory model states, and I'm assuming it is very similar to the C11 model. I have also forgotten what LKMM states :/ Do they all agree on what RELEASE+ACQUIRE makes? > +//! - [`Full`] means "fully-ordered", that is: > +//! - It provides ordering between all the preceding memory accesses and the annotated operation. > +//! - It provides ordering between the annotated operation and all the following memory accesses. > +//! - It provides ordering between all the preceding memory accesses and all the fllowing memory > +//! accesses. > +//! - All the orderings are the same strong as a full memory barrier (i.e. `smp_mb()`). s/strong/strength/ ? > +//! - [`Relaxed`] is similar to the counterpart in Rust memory model, except that dependency > +//! orderings are also honored in [`LKMM`]. Dependency orderings are described in "DEPENDENCY > +//! RELATIONS" in [`LKMM`]'s [`explanation`]. > +//! > +//! [`LKMM`]: srctree/tools/memory-model/ > +//! [`explanation`]: srctree/tools/memory-model/Documentation/explanation.txt