Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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/20231004165317.1061855-9-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Andreas Dilger <adilger.kernel@dilger.ca>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Richard Henderson <richard.henderson@linaro.org>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Matthew Wilcox (Oracle) and committed by
Andrew Morton
e28ff5dc 247dbcdb

+21
+21
arch/alpha/include/asm/bitops.h
··· 286 286 #define arch_test_bit generic_test_bit 287 287 #define arch_test_bit_acquire generic_test_bit_acquire 288 288 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 + 289 310 /* 290 311 * ffz = Find First Zero in word. Undefined if no zero exists, 291 312 * so code should check against ~0UL first..