]> www.infradead.org Git - users/willy/pagecache.git/commitdiff
s390: Implement arch_xor_unlock_is_negative_byte
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Wed, 19 Jul 2023 19:50:04 +0000 (15:50 -0400)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Wed, 4 Oct 2023 01:18:59 +0000 (21:18 -0400)
Inspired by the s390 arch_test_and_clear_bit(), this will surely be
more efficient than the generic one defined in filemap.c.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
arch/s390/include/asm/bitops.h

index 2de74fcd0578f42c25d178f4f3ef1dbbaa30158c..c467dffa8c12a5714d5aad1986bbf5cab801bbf0 100644 (file)
@@ -201,6 +201,16 @@ static inline void arch___clear_bit_unlock(unsigned long nr,
        arch___clear_bit(nr, ptr);
 }
 
+static inline bool arch_xor_unlock_is_negative_byte(unsigned long mask,
+               volatile unsigned long *ptr)
+{
+       unsigned long old;
+
+       old = __atomic64_xor_barrier(mask, (long *)ptr);
+       return old & BIT(7);
+}
+#define arch_xor_unlock_is_negative_byte arch_xor_unlock_is_negative_byte
+
 #include <asm-generic/bitops/instrumented-atomic.h>
 #include <asm-generic/bitops/instrumented-non-atomic.h>
 #include <asm-generic/bitops/instrumented-lock.h>