lkml.org 
[lkml]   [2022]   [Jan]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 24/35] mm: write lock mmu_notifier_lock when registering mmu notifiers
Date
Change mm_take_all_locks to also take the mmu_notifier_lock.
Note that mm_take_all_locks is called from mmu_notifier_register() only.

Signed-off-by: Michel Lespinasse <michel@lespinasse.org>
---
mm/mmap.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/mm/mmap.c b/mm/mmap.c
index b09a2c875507..a67c3600d995 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -3592,6 +3592,10 @@ int mm_take_all_locks(struct mm_struct *mm)

mutex_lock(&mm_all_locks_mutex);

+#if defined(CONFIG_MMU_NOTIFIER) && defined(CONFIG_SPECULATIVE_PAGE_FAULT)
+ percpu_down_write(mm->mmu_notifier_lock);
+#endif
+
for (vma = mm->mmap; vma; vma = vma->vm_next) {
if (signal_pending(current))
goto out_unlock;
@@ -3679,6 +3683,10 @@ void mm_drop_all_locks(struct mm_struct *mm)
vm_unlock_mapping(vma->vm_file->f_mapping);
}

+#if defined(CONFIG_MMU_NOTIFIER) && defined(CONFIG_SPECULATIVE_PAGE_FAULT)
+ percpu_up_write(mm->mmu_notifier_lock);
+#endif
+
mutex_unlock(&mm_all_locks_mutex);
}

--
2.20.1
\
 
 \ /
  Last update: 2022-01-28 14:21    [W:0.682 / U:0.704 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site