git: f26382dd72df - main - atomic.9: fix description of acquire and release
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 02 Nov 2025 21:22:22 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=f26382dd72dfc710a8cc7159364a8166e22a4254
commit f26382dd72dfc710a8cc7159364a8166e22a4254
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2025-10-05 08:39:32 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-11-02 21:22:08 +0000
atomic.9: fix description of acquire and release
The ordering point is not the atomic operation itself, but the load for
acquire or store for release done as part of the atomic. This does not
matter for atomic_load_acq and atomic_store_rel, but does matter for RWM
operations.
Noted by: alc
Reviewed by: markj
Discussed with: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D52744
---
share/man/man9/atomic.9 | 27 +++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/share/man/man9/atomic.9 b/share/man/man9/atomic.9
index c9133c6311a5..674959648330 100644
--- a/share/man/man9/atomic.9
+++ b/share/man/man9/atomic.9
@@ -182,35 +182,42 @@ This variant is the default.
The second variant has acquire semantics, and the third variant has release
semantics.
.Pp
-When an atomic operation has acquire semantics, the operation must have
+An atomic operation can only have
+.Em acquire
+semantics if it performs a load
+from memory.
+When an atomic operation has acquire semantics, a load performed as
+part of the operation must have
completed before any subsequent load or store (by program order) is
performed.
Conversely, acquire semantics do not require that prior loads or stores have
-completed before the atomic operation is performed.
-An atomic operation can only have acquire semantics if it performs a load
-from memory.
+completed before a load from the atomic operation is performed.
To denote acquire semantics, the suffix
.Dq Li _acq
is inserted into the function name immediately prior to the
.Dq Li _ Ns Aq Fa type
suffix.
-For example, to subtract two integers ensuring that the subtraction is
+For example, to subtract two integers ensuring that the load of
+the value from memory is
completed before any subsequent loads and stores are performed, use
.Fn atomic_subtract_acq_int .
.Pp
+An atomic operation can only have
+.Em release
+semantics if it performs a store to memory.
When an atomic operation has release semantics, all prior loads or stores
-(by program order) must have completed before the operation is performed.
-Conversely, release semantics do not require that the atomic operation must
+(by program order) must have completed before a store executed as part of
+the operation that is performed.
+Conversely, release semantics do not require that a store from the atomic
+operation must
have completed before any subsequent load or store is performed.
-An atomic operation can only have release semantics if it performs a store
-to memory.
To denote release semantics, the suffix
.Dq Li _rel
is inserted into the function name immediately prior to the
.Dq Li _ Ns Aq Fa type
suffix.
For example, to add two long integers ensuring that all prior loads and
-stores are completed before the addition is performed, use
+stores are completed before the store of the result is performed, use
.Fn atomic_add_rel_long .
.Pp
When a release operation by one thread