@@ -1512,34 +1512,6 @@ void folio_add_wait_queue(struct folio *folio, wait_queue_entry_t *waiter)
15121512}
15131513EXPORT_SYMBOL_GPL (folio_add_wait_queue );
15141514
1515- #ifdef xor_unlock_is_negative_byte
1516- #define clear_bit_unlock_is_negative_byte (nr , p ) \
1517- xor_unlock_is_negative_byte(1 << nr, p)
1518- #endif
1519-
1520- #ifndef clear_bit_unlock_is_negative_byte
1521-
1522- /*
1523- * PG_waiters is the high bit in the same byte as PG_lock.
1524- *
1525- * On x86 (and on many other architectures), we can clear PG_lock and
1526- * test the sign bit at the same time. But if the architecture does
1527- * not support that special operation, we just do this all by hand
1528- * instead.
1529- *
1530- * The read of PG_waiters has to be after (or concurrently with) PG_locked
1531- * being cleared, but a memory barrier should be unnecessary since it is
1532- * in the same byte as PG_locked.
1533- */
1534- static inline bool clear_bit_unlock_is_negative_byte (long nr , volatile void * mem )
1535- {
1536- clear_bit_unlock (nr , mem );
1537- /* smp_mb__after_atomic(); */
1538- return test_bit (PG_waiters , mem );
1539- }
1540-
1541- #endif
1542-
15431515/**
15441516 * folio_unlock - Unlock a locked folio.
15451517 * @folio: The folio.
@@ -1555,7 +1527,7 @@ void folio_unlock(struct folio *folio)
15551527 BUILD_BUG_ON (PG_waiters != 7 );
15561528 BUILD_BUG_ON (PG_locked > 7 );
15571529 VM_BUG_ON_FOLIO (!folio_test_locked (folio ), folio );
1558- if (clear_bit_unlock_is_negative_byte ( PG_locked , folio_flags (folio , 0 )))
1530+ if (xor_unlock_is_negative_byte ( 1 << PG_locked , folio_flags (folio , 0 )))
15591531 folio_wake_bit (folio , PG_locked );
15601532}
15611533EXPORT_SYMBOL (folio_unlock );
0 commit comments