UPSTREAM: mm: move mmap_lock assert function definitions
Move mmap_lock assert function definitions up so that they can be used by other mmap_lock routines. Link: https://lkml.kernel.org/r/20230227173632.3292573-12-surenb@google.com Signed-off-by: Suren Baghdasaryan <surenb@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> (cherry picked from commit 438b6e12cd603a9416ca7c5462ab75b2a8c4d5b9) Bug: 161210518 Change-Id: I4cd6a235983b38b8ce58af0e771251b25b9062f0 Signed-off-by: Suren Baghdasaryan <surenb@google.com>
This commit is contained in:
parent
e28a0a0e5c
commit
882c3512ec
1 changed files with 12 additions and 12 deletions
|
|
@ -60,6 +60,18 @@ 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)
|
||||
{
|
||||
lockdep_assert_held(&mm->mmap_lock);
|
||||
VM_BUG_ON_MM(!rwsem_is_locked(&mm->mmap_lock), mm);
|
||||
}
|
||||
|
||||
static inline void mmap_assert_write_locked(struct mm_struct *mm)
|
||||
{
|
||||
lockdep_assert_held_write(&mm->mmap_lock);
|
||||
VM_BUG_ON_MM(!rwsem_is_locked(&mm->mmap_lock), mm);
|
||||
}
|
||||
|
||||
static inline void mmap_init_lock(struct mm_struct *mm)
|
||||
{
|
||||
init_rwsem(&mm->mmap_lock);
|
||||
|
|
@ -150,18 +162,6 @@ static inline void mmap_read_unlock_non_owner(struct mm_struct *mm)
|
|||
up_read_non_owner(&mm->mmap_lock);
|
||||
}
|
||||
|
||||
static inline void mmap_assert_locked(struct mm_struct *mm)
|
||||
{
|
||||
lockdep_assert_held(&mm->mmap_lock);
|
||||
VM_BUG_ON_MM(!rwsem_is_locked(&mm->mmap_lock), mm);
|
||||
}
|
||||
|
||||
static inline void mmap_assert_write_locked(struct mm_struct *mm)
|
||||
{
|
||||
lockdep_assert_held_write(&mm->mmap_lock);
|
||||
VM_BUG_ON_MM(!rwsem_is_locked(&mm->mmap_lock), mm);
|
||||
}
|
||||
|
||||
static inline int mmap_lock_is_contended(struct mm_struct *mm)
|
||||
{
|
||||
return rwsem_is_contended(&mm->mmap_lock);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue