@@ -1482,34 +1482,6 @@ void folio_add_wait_queue(struct folio *folio, wait_queue_entry_t *waiter)
14821482}
14831483EXPORT_SYMBOL_GPL (folio_add_wait_queue );
14841484
1485- #ifdef xor_unlock_is_negative_byte
1486- #define clear_bit_unlock_is_negative_byte (nr , p ) \
1487- xor_unlock_is_negative_byte(1 << nr, p)
1488- #endif
1489-
1490- #ifndef clear_bit_unlock_is_negative_byte
1491-
1492- /*
1493- * PG_waiters is the high bit in the same byte as PG_lock.
1494- *
1495- * On x86 (and on many other architectures), we can clear PG_lock and
1496- * test the sign bit at the same time. But if the architecture does
1497- * not support that special operation, we just do this all by hand
1498- * instead.
1499- *
1500- * The read of PG_waiters has to be after (or concurrently with) PG_locked
1501- * being cleared, but a memory barrier should be unnecessary since it is
1502- * in the same byte as PG_locked.
1503- */
1504- static inline bool clear_bit_unlock_is_negative_byte (long nr , volatile void * mem )
1505- {
1506- clear_bit_unlock (nr , mem );
1507- /* smp_mb__after_atomic(); */
1508- return test_bit (PG_waiters , mem );
1509- }
1510-
1511- #endif
1512-
15131485/**
15141486 * folio_unlock - Unlock a locked folio.
15151487 * @folio: The folio.
@@ -1525,7 +1497,7 @@ void folio_unlock(struct folio *folio)
15251497 BUILD_BUG_ON (PG_waiters != 7 );
15261498 BUILD_BUG_ON (PG_locked > 7 );
15271499 VM_BUG_ON_FOLIO (!folio_test_locked (folio ), folio );
1528- if (clear_bit_unlock_is_negative_byte ( PG_locked , folio_flags (folio , 0 )))
1500+ if (xor_unlock_is_negative_byte ( 1 << PG_locked , folio_flags (folio , 0 )))
15291501 folio_wake_bit (folio , PG_locked );
15301502}
15311503EXPORT_SYMBOL (folio_unlock );
0 commit comments