The patch titled Subject: smp_mb__{before,after}_atomic(): update Documentation has been added to the -mm tree. Its filename is smp_mb__beforeafter_atomic-update-documentation.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/smp_mb__beforeafter_atomic-update-documentation.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/smp_mb__beforeafter_atomic-update-documentation.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Manfred Spraul <manfred@xxxxxxxxxxxxxxxx> Subject: smp_mb__{before,after}_atomic(): update Documentation When adding the _{acquire|release|relaxed}() variants of some atomic operations, it was forgotten to update Documentation/memory_barrier.txt: smp_mb__{before,after}_atomic() is now intended for all RMW operations that do not imply a memory barrier. 1) smp_mb__before_atomic(); atomic_add(); 2) smp_mb__before_atomic(); atomic_xchg_relaxed(); 3) smp_mb__before_atomic(); atomic_fetch_add_relaxed(); Invalid would be: smp_mb__before_atomic(); atomic_set(); In addition, the patch splits the long sentence into multiple shorter sentences. Link: http://lkml.kernel.org/r/20191020123305.14715-2-manfred@xxxxxxxxxxxxxxxx Fixes: 654672d4ba1a ("locking/atomics: Add _{acquire|release|relaxed}() variants of some atomic operations") Signed-off-by: Manfred Spraul <manfred@xxxxxxxxxxxxxxxx> Acked-by: Waiman Long <longman@xxxxxxxxxx> Cc: Davidlohr Bueso <dave@xxxxxxxxxxxx> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx> Cc: Will Deacon <will.deacon@xxxxxxx> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx> Cc: <1vier1@xxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- Documentation/memory-barriers.txt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) --- a/Documentation/memory-barriers.txt~smp_mb__beforeafter_atomic-update-documentation +++ a/Documentation/memory-barriers.txt @@ -1873,12 +1873,16 @@ There are some more advanced barrier fun (*) smp_mb__before_atomic(); (*) smp_mb__after_atomic(); - These are for use with atomic (such as add, subtract, increment and - decrement) functions that don't return a value, especially when used for - reference counting. These functions do not imply memory barriers. + These are for use with atomic RMW functions that do not imply memory + barriers, but where the code needs a memory barrier. Examples for atomic + RMW functions that do not imply are memory barrier are e.g. add, + subtract, (failed) conditional operations, _relaxed functions, + but not atomic_read or atomic_set. A common example where a memory + barrier may be required is when atomic ops are used for reference + counting. - These are also used for atomic bitop functions that do not return a - value (such as set_bit and clear_bit). + These are also used for atomic RMW bitop functions that do not imply a + memory barrier (such as set_bit and clear_bit). As an example, consider a piece of code that marks an object as being dead and then decrements the object's reference count: _ Patches currently in -mm which might be from manfred@xxxxxxxxxxxxxxxx are smp_mb__beforeafter_atomic-update-documentation.patch ipc-mqueuec-update-document-memory-barriers.patch ipc-msgc-update-and-document-memory-barriers.patch ipc-semc-document-and-update-memory-barriers.patch