@@ -1482,34 +1482,6 @@ void folio_add_wait_queue(struct folio *folio, wait_queue_entry_t *waiter)
1482
1482
}
1483
1483
EXPORT_SYMBOL_GPL (folio_add_wait_queue );
1484
1484
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
-
1513
1485
/**
1514
1486
* folio_unlock - Unlock a locked folio.
1515
1487
* @folio: The folio.
@@ -1525,7 +1497,7 @@ void folio_unlock(struct folio *folio)
1525
1497
BUILD_BUG_ON (PG_waiters != 7 );
1526
1498
BUILD_BUG_ON (PG_locked > 7 );
1527
1499
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 )))
1529
1501
folio_wake_bit (folio , PG_locked );
1530
1502
}
1531
1503
EXPORT_SYMBOL (folio_unlock );
0 commit comments