@@ -58,27 +58,30 @@ static inline bool test_and_set_bit_lock(long nr, volatile unsigned long *addr)
58
58
return arch_test_and_set_bit_lock (nr , addr );
59
59
}
60
60
61
- #if defined(arch_clear_bit_unlock_is_negative_byte )
61
+ #if defined(arch_xor_unlock_is_negative_byte )
62
62
/**
63
- * clear_bit_unlock_is_negative_byte - Clear a bit in memory and test if bottom
64
- * byte is negative, for unlock.
65
- * @nr: the bit to clear
66
- * @addr: the address to start counting from
63
+ * xor_unlock_is_negative_byte - XOR a single byte in memory and test if
64
+ * it is negative, for unlock.
65
+ * @mask: Change the bits which are set in this mask.
66
+ * @addr: The address of the word containing the byte to change.
67
67
*
68
+ * Changes some of bits 0-6 in the word pointed to by @addr.
68
69
* This operation is atomic and provides release barrier semantics.
70
+ * Used to optimise some folio operations which are commonly paired
71
+ * with an unlock or end of writeback. Bit 7 is used as PG_waiters to
72
+ * indicate whether anybody is waiting for the unlock.
69
73
*
70
- * This is a bit of a one-trick-pony for the filemap code, which clears
71
- * PG_locked and tests PG_waiters,
74
+ * Return: Whether the top bit of the byte is set.
72
75
*/
73
- static inline bool
74
- clear_bit_unlock_is_negative_byte ( long nr , volatile unsigned long * addr )
76
+ static inline bool xor_unlock_is_negative_byte ( unsigned long mask ,
77
+ volatile unsigned long * addr )
75
78
{
76
79
kcsan_release ();
77
- instrument_atomic_write (addr + BIT_WORD ( nr ) , sizeof (long ));
78
- return arch_clear_bit_unlock_is_negative_byte ( nr , addr );
80
+ instrument_atomic_write (addr , sizeof (long ));
81
+ return arch_xor_unlock_is_negative_byte ( mask , addr );
79
82
}
80
83
/* Let everybody know we have it. */
81
- #define clear_bit_unlock_is_negative_byte clear_bit_unlock_is_negative_byte
84
+ #define xor_unlock_is_negative_byte xor_unlock_is_negative_byte
82
85
#endif
83
86
84
87
#endif /* _ASM_GENERIC_BITOPS_INSTRUMENTED_LOCK_H */
0 commit comments