]> www.infradead.org Git - users/willy/pagecache.git/commitdiff
mm: Assert the mmap_lock is held in __anon_vma_prepare()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Fri, 12 Apr 2024 13:47:53 +0000 (09:47 -0400)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Fri, 12 Apr 2024 16:01:58 +0000 (12:01 -0400)
Convert the comment into an assertion.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
mm/rmap.c

index 3746a553101832164b8171c188fd9f9d6af1b6af..869cb77f67ad11eb41b966a03f1113e4be2b77ef 100644 (file)
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -182,8 +182,6 @@ static void anon_vma_chain_link(struct vm_area_struct *vma,
  * for the new allocation. At the same time, we do not want
  * to do any locking for the common case of already having
  * an anon_vma.
- *
- * This must be called with the mmap_lock held for reading.
  */
 int __anon_vma_prepare(struct vm_area_struct *vma)
 {
@@ -191,6 +189,7 @@ int __anon_vma_prepare(struct vm_area_struct *vma)
        struct anon_vma *anon_vma, *allocated;
        struct anon_vma_chain *avc;
 
+       mmap_assert_locked(mm);
        might_sleep();
 
        avc = anon_vma_chain_alloc(GFP_KERNEL);