]> Git Repo - linux.git/commitdiff
mm: use rwsem assertion macros for mmap_lock
authorMatthew Wilcox (Oracle) <[email protected]>
Wed, 27 Mar 2024 19:06:59 +0000 (19:06 +0000)
committerAndrew Morton <[email protected]>
Fri, 26 Apr 2024 03:56:24 +0000 (20:56 -0700)
This slightly strengthens our write assertion when lockdep is disabled.
It also downgrades us from BUG_ON to WARN_ON, but I think that's an
improvement.  I don't think dumping the mm_struct was all that valuable;
the call chain is what's important.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Matthew Wilcox (Oracle) <[email protected]>
Reviewed-by: David Hildenbrand <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
include/linux/mmap_lock.h

index 8d38dcb6d044cb73ac9338515f73e69817622fd9..de9dc20b01ba7471d288c58a3b0d600e3b1eaa62 100644 (file)
@@ -60,16 +60,14 @@ static inline void __mmap_lock_trace_released(struct mm_struct *mm, bool write)
 
 #endif /* CONFIG_TRACING */
 
-static inline void mmap_assert_locked(struct mm_struct *mm)
+static inline void mmap_assert_locked(const struct mm_struct *mm)
 {
-       lockdep_assert_held(&mm->mmap_lock);
-       VM_BUG_ON_MM(!rwsem_is_locked(&mm->mmap_lock), mm);
+       rwsem_assert_held(&mm->mmap_lock);
 }
 
-static inline void mmap_assert_write_locked(struct mm_struct *mm)
+static inline void mmap_assert_write_locked(const struct mm_struct *mm)
 {
-       lockdep_assert_held_write(&mm->mmap_lock);
-       VM_BUG_ON_MM(!rwsem_is_locked(&mm->mmap_lock), mm);
+       rwsem_assert_held_write(&mm->mmap_lock);
 }
 
 #ifdef CONFIG_PER_VMA_LOCK
This page took 0.063609 seconds and 4 git commands to generate.