[PATCH v4 03/39] mm: Add guard for mmap_read_lock

From: Josh Poimboeuf
Date: Tue Jan 21 2025 - 21:32:36 EST


This is the new way of doing things. Converting all existing
mmap_read_lock users is an exercise left for the reader ;-)

Suggested-by: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
---
include/linux/mmap_lock.h | 2 ++
1 file changed, 2 insertions(+)

diff --git a/include/linux/mmap_lock.h b/include/linux/mmap_lock.h
index de9dc20b01ba..c971c4617060 100644
--- a/include/linux/mmap_lock.h
+++ b/include/linux/mmap_lock.h
@@ -182,4 +182,6 @@ static inline int mmap_lock_is_contended(struct mm_struct *mm)
return rwsem_is_contended(&mm->mmap_lock);
}

+DEFINE_GUARD(mmap_read_lock, struct mm_struct *, mmap_read_lock(_T), mmap_read_unlock(_T))
+
#endif /* _LINUX_MMAP_LOCK_H */
--
2.48.1