mirror of
https://github.com/torvalds/linux.git
synced 2024-11-27 06:31:52 +00:00
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>
This commit is contained in:
parent
c0bff412e6
commit
ba168b52bf
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user