summaryrefslogtreecommitdiffstats
path: root/include/linux/mmap_lock.h
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2024-03-27 19:06:59 +0000
committerAndrew Morton <akpm@linux-foundation.org>2024-04-25 20:56:24 -0700
commitba168b52bf8ecb877af294769b0ab32b06bd9293 (patch)
treeeba3355bc79ecfd5baf11483f3a3355142b893e0 /include/linux/mmap_lock.h
parentc0bff412e67b781d761e330ff9578aa9ed2be79e (diff)
downloadlinux-ba168b52bf8ecb877af294769b0ab32b06bd9293.tar.gz
linux-ba168b52bf8ecb877af294769b0ab32b06bd9293.tar.bz2
linux-ba168b52bf8ecb877af294769b0ab32b06bd9293.zip
mm: use rwsem assertion macros for mmap_lock
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/20240327190701.1082560-1-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: David Hildenbrand <david@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'include/linux/mmap_lock.h')
-rw-r--r--include/linux/mmap_lock.h10
1 files changed, 4 insertions, 6 deletions
diff --git a/include/linux/mmap_lock.h b/include/linux/mmap_lock.h
index 8d38dcb6d044..de9dc20b01ba 100644
--- a/include/linux/mmap_lock.h
+++ b/include/linux/mmap_lock.h
@@ -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