Skip to content

Commit e28ff5d

Browse files
Matthew Wilcox (Oracle)akpm00
authored andcommitted
alpha: implement xor_unlock_is_negative_byte
Inspired by the alpha clear_bit() and arch_atomic_add_return(), this will surely be more efficient than the generic one defined in filemap.c. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Cc: Albert Ou <[email protected]> Cc: Alexander Gordeev <[email protected]> Cc: Andreas Dilger <[email protected]> Cc: Christian Borntraeger <[email protected]> Cc: Christophe Leroy <[email protected]> Cc: Geert Uytterhoeven <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Ivan Kokshaysky <[email protected]> Cc: Matt Turner <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Nicholas Piggin <[email protected]> Cc: Palmer Dabbelt <[email protected]> Cc: Paul Walmsley <[email protected]> Cc: Richard Henderson <[email protected]> Cc: Sven Schnelle <[email protected]> Cc: "Theodore Ts'o" <[email protected]> Cc: Thomas Bogendoerfer <[email protected]> Cc: Vasily Gorbik <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 247dbcd commit e28ff5d

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

arch/alpha/include/asm/bitops.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,27 @@ arch___test_and_change_bit(unsigned long nr, volatile unsigned long *addr)
286286
#define arch_test_bit generic_test_bit
287287
#define arch_test_bit_acquire generic_test_bit_acquire
288288

289+
static inline bool xor_unlock_is_negative_byte(unsigned long mask,
290+
volatile unsigned long *p)
291+
{
292+
unsigned long temp, old;
293+
294+
__asm__ __volatile__(
295+
"1: ldl_l %0,%4\n"
296+
" mov %0,%2\n"
297+
" xor %0,%3,%0\n"
298+
" stl_c %0,%1\n"
299+
" beq %0,2f\n"
300+
".subsection 2\n"
301+
"2: br 1b\n"
302+
".previous"
303+
:"=&r" (temp), "=m" (*p), "=&r" (old)
304+
:"Ir" (mask), "m" (*p));
305+
306+
return (old & BIT(7)) != 0;
307+
}
308+
#define xor_unlock_is_negative_byte xor_unlock_is_negative_byte
309+
289310
/*
290311
* ffz = Find First Zero in word. Undefined if no zero exists,
291312
* so code should check against ~0UL first..

0 commit comments

Comments
 (0)