History

mm/mmu_notifiers: prime lockdep

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.

Daniel Vetter committed 7 years ago

Commit 66204f11 parent 23b68391 file · +7 −0Browse files

Unified · Split

mm/mmu_notifier.c+7−0
@@ -243,6 +243,13 @@ int __mmu_notifier_register(struct mmu_notifier *mn, struct mm_struct *mm) · 242 unmodified lines
243243 lockdep_assert_held_write(&mm->mmap_sem);
244244 BUG_ON(atomic_read(&mm->mm_users) <= 0);
245245
246+ if (IS_ENABLED(CONFIG_LOCKDEP)) {
247+ fs_reclaim_acquire(GFP_KERNEL);
248+ lock_map_acquire(&__mmu_notifier_invalidate_range_start_map);
249+ lock_map_release(&__mmu_notifier_invalidate_range_start_map);
250+ fs_reclaim_release(GFP_KERNEL);
251+ }
252+
246253 mn->mm = mm;
247254 mn->users = 1;
248255

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t