Skip to content

Commit

Permalink
MIPS: bitops: Use smp_mb__before_atomic in test_* ops
Browse files Browse the repository at this point in the history
Use smp_mb__before_atomic() rather than smp_mb__before_llsc() in
test_and_set_bit(), test_and_clear_bit() & test_and_change_bit(). The
_atomic() versions make semantic sense in these cases, and will allow a
later patch to omit redundant barriers for Loongson3 systems that
already include a barrier within __test_bit_op().

Signed-off-by: Paul Burton <paul.burton@mips.com>
Cc: linux-mips@vger.kernel.org
Cc: Huacai Chen <chenhc@lemote.com>
Cc: Jiaxun Yang <jiaxun.yang@flygoat.com>
Cc: linux-kernel@vger.kernel.org
  • Loading branch information
Paul Burton committed Oct 7, 2019
1 parent 5bb2927 commit 9026737
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions arch/mips/include/asm/bitops.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ static inline int test_and_set_bit_lock(unsigned long nr,
static inline int test_and_set_bit(unsigned long nr,
volatile unsigned long *addr)
{
smp_mb__before_llsc();
smp_mb__before_atomic();
return test_and_set_bit_lock(nr, addr);
}

Expand All @@ -228,7 +228,7 @@ static inline int test_and_clear_bit(unsigned long nr,
int bit = nr % BITS_PER_LONG;
unsigned long res, orig;

smp_mb__before_llsc();
smp_mb__before_atomic();

if (!kernel_uses_llsc) {
res = __mips_test_and_clear_bit(nr, addr);
Expand Down Expand Up @@ -265,7 +265,7 @@ static inline int test_and_change_bit(unsigned long nr,
int bit = nr % BITS_PER_LONG;
unsigned long res, orig;

smp_mb__before_llsc();
smp_mb__before_atomic();

if (!kernel_uses_llsc) {
res = __mips_test_and_change_bit(nr, addr);
Expand Down

0 comments on commit 9026737

Please sign in to comment.