]> Git Repo - linux.git/commitdiff
mm/mmu_notifiers: prime lockdep
authorDaniel Vetter <[email protected]>
Mon, 26 Aug 2019 20:14:22 +0000 (22:14 +0200)
committerJason Gunthorpe <[email protected]>
Sat, 7 Sep 2019 07:28:04 +0000 (04:28 -0300)
We want to teach lockdep that mmu notifiers can be called from direct
reclaim paths, since on many CI systems load might never reach that
level (e.g. when just running fuzzer or small functional tests).

I've put the annotation into mmu_notifier_register since only when we have
mmu notifiers registered is there any point in teaching lockdep about
them. Also, we already have a kmalloc(, GFP_KERNEL), so this is safe.

Link: https://lore.kernel.org/r/[email protected]
Suggested-by: Jason Gunthorpe <[email protected]>
Reviewed-by: Jason Gunthorpe <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
Signed-off-by: Jason Gunthorpe <[email protected]>
mm/mmu_notifier.c

index 05d98167da7bbdc64012ff6ea711cb293508aa58..3f39fb1402db24ae73dfd10080858ea6cf64fedf 100644 (file)
@@ -243,6 +243,13 @@ int __mmu_notifier_register(struct mmu_notifier *mn, struct mm_struct *mm)
        lockdep_assert_held_write(&mm->mmap_sem);
        BUG_ON(atomic_read(&mm->mm_users) <= 0);
 
+       if (IS_ENABLED(CONFIG_LOCKDEP)) {
+               fs_reclaim_acquire(GFP_KERNEL);
+               lock_map_acquire(&__mmu_notifier_invalidate_range_start_map);
+               lock_map_release(&__mmu_notifier_invalidate_range_start_map);
+               fs_reclaim_release(GFP_KERNEL);
+       }
+
        mn->mm = mm;
        mn->users = 1;
 
This page took 0.056273 seconds and 4 git commands to generate.