Skip to content

Commit

Permalink
MIPS: atomic: Use _atomic barriers in atomic_sub_if_positive()
Browse files Browse the repository at this point in the history
Use smp_mb__before_atomic() & smp_mb__after_atomic() in
atomic_sub_if_positive() rather than the equivalent
smp_mb__before_llsc() & smp_llsc_mb(). The former are more standard &
this preps us for avoiding redundant duplicate barriers on Loongson3 in
a later patch.

Signed-off-by: Paul Burton <[email protected]>
Cc: [email protected]
Cc: Huacai Chen <[email protected]>
Cc: Jiaxun Yang <[email protected]>
Cc: [email protected]
  • Loading branch information
paulburton committed Oct 7, 2019
1 parent 4d1dbfe commit 77d281b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/mips/include/asm/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ static __inline__ int atomic_sub_if_positive(int i, atomic_t * v)
{
int result;

smp_mb__before_llsc();
smp_mb__before_atomic();

if (kernel_uses_llsc) {
int temp;
Expand Down Expand Up @@ -237,7 +237,7 @@ static __inline__ int atomic_sub_if_positive(int i, atomic_t * v)
* another barrier here.
*/
if (!__SYNC_loongson3_war)
smp_llsc_mb();
smp_mb__after_atomic();

return result;
}
Expand Down

0 comments on commit 77d281b

Please sign in to comment.