[PATCH RFC 07/11] folio_wait: convert VM_BUG_ON_FOLIO() to VM_WARN_ON_ONCE_FOLIO()
Tal Zussman <[email protected]>
| Newsgroups | org.kernel.vger.io-uring,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-kernel,org.kvack.linux-mm |
|---|---|
| Message-ID | <[email protected]> |
BUG_ON() is deprecated [1]. The VM_BUG_ON_FOLIO() assertions in folio_unlock(), folio_end_read(), and folio_end_private_2() verify folio state invariants and are already debug checks. There is no additional benefit gained by crashing the system. Convert them to VM_WARN_ON_ONCE_FOLIO(), as is now preferred for such checks. [1] https://www.kernel.org/doc/html/latest/process/coding-style.html#use-warn-rather-than-bug Signed-off-by: Tal Zussman <[email protected]> --- mm/folio_wait.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/folio_wait.c b/mm/folio_wait.c index 70f808729f9c..52d336bc7fe0 100644 --- a/mm/folio_wait.c +++ b/mm/folio_wait.c @@ -465,7 +465,7 @@ void folio_unlock(struct folio *folio) /* Bit 7 allows x86 to check the byte's sign bit */ BUILD_BUG_ON(PG_waiters != 7); BUILD_BUG_ON(PG_locked > 7); - VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio); + VM_WARN_ON_ONCE_FOLIO(!folio_test_locked(folio), folio); if (folio_xor_flags_has_waiters(folio, 1 << PG_locked)) folio_wake_bit(folio, PG_locked); } @@ -490,8 +490,8 @@ void folio_end_read(struct folio *folio, bool success) /* Must be in bottom byte for x86 to work */ BUILD_BUG_ON(PG_uptodate > 7); - VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio); - VM_BUG_ON_FOLIO(success && folio_test_uptodate(folio), folio); + VM_WARN_ON_ONCE_FOLIO(!folio_test_locked(folio), folio); + VM_WARN_ON_ONCE_FOLIO(success && folio_test_uptodate(folio), folio); if (likely(success)) mask |= 1 << PG_uptodate; @@ -513,7 +513,7 @@ EXPORT_SYMBOL(folio_end_read); */ void folio_end_private_2(struct folio *folio) { - VM_BUG_ON_FOLIO(!folio_test_private_2(folio), folio); + VM_WARN_ON_ONCE_FOLIO(!folio_test_private_2(folio), folio); clear_bit_unlock(PG_private_2, folio_flags(folio, 0)); folio_wake_bit(folio, PG_private_2); folio_put(folio); -- 2.39.5