On Fri, May 24, 2019 at 12:42:20PM +0100, Will Deacon wrote:
diff --git a/Documentation/atomic_t.txt b/Documentation/atomic_t.txt index dca3fb0554db..125c95ddbbc0 100644 --- a/Documentation/atomic_t.txt +++ b/Documentation/atomic_t.txt @@ -83,6 +83,9 @@ The non-RMW ops are (typically) regular LOADs and STOREs and are canonically implemented using READ_ONCE(), WRITE_ONCE(), smp_load_acquire() and smp_store_release() respectively.
Not sure you need a new paragraph here.
+Therefore, if you find yourself only using the Non-RMW operations of atomic_t, +you do not in fact need atomic_t at all and are doing it wrong.
That makes sense to me, although I now find that the sentence below is a bit confusing because it sounds like it's a caveat relating to only using Non-RMW ops.
The one detail to this is that atomic_set{}() should be observable to the RMW ops. That is:
How about changing this to be:
"A subtle detail of atomic_set{}() is that it should be observable..."
Done, find below.
--- Subject: Documentation/atomic_t.txt: Clarify pure non-rmw usage
Clarify that pure non-RMW usage of atomic_t is pointless, there is nothing 'magical' about atomic_set() / atomic_read().
This is something that seems to confuse people, because I happen upon it semi-regularly.
Acked-by: Will Deacon will.deacon@arm.com Reviewed-by: Greg Kroah-Hartman gregkh@linuxfoundation.org Signed-off-by: Peter Zijlstra (Intel) peterz@infradead.org --- Documentation/atomic_t.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/Documentation/atomic_t.txt b/Documentation/atomic_t.txt index dca3fb0554db..89eae7f6b360 100644 --- a/Documentation/atomic_t.txt +++ b/Documentation/atomic_t.txt @@ -81,9 +81,11 @@ SEMANTICS
The non-RMW ops are (typically) regular LOADs and STOREs and are canonically implemented using READ_ONCE(), WRITE_ONCE(), smp_load_acquire() and -smp_store_release() respectively. +smp_store_release() respectively. Therefore, if you find yourself only using +the Non-RMW operations of atomic_t, you do not in fact need atomic_t at all +and are doing it wrong.
-The one detail to this is that atomic_set{}() should be observable to the RMW +A subtle detail of atomic_set{}() is that it should be observable to the RMW ops. That is:
C atomic-set