History

mm/mmu_notifiers: annotate with might_sleep()

Since mmu notifiers don't exist for many processes, but could block in interesting places, add some annotations. This should help make sure the core mm keeps up its end of the mmu notifier contract. The checks here are outside of all notifier checks because of that. They compile away without CONFIG_DEBUG_ATOMIC_SLEEP.

Daniel Vetter committed 7 years ago

Commit 810e24e1 parent 66204f11 file · +5 −0Browse files

Showing the changes to include/linux (1 of 1 file). Show all

Unified · Split

include/linux/mmu_notifier.h+5−0
@@ -343,6 +343,8 @@ static inline void mmu_notifier_change_pte(struct mm_struct *mm, · 342 unmodified lines
343343 static inline void
344344 mmu_notifier_invalidate_range_start(struct mmu_notifier_range *range)
345345 {
346+ might_sleep();
347+
346348 lock_map_acquire(&__mmu_notifier_invalidate_range_start_map);
347349 if (mm_has_notifiers(range->mm)) {
348350 range->flags |= MMU_NOTIFIER_RANGE_BLOCKABLE;
@@ -368,6 +370,9 @@ mmu_notifier_invalidate_range_start_nonblock(struct mmu_notifier_range *range) · 19 unmodified lines
368370 static inline void
369371 mmu_notifier_invalidate_range_end(struct mmu_notifier_range *range)
370372 {
373+ if (mmu_notifier_range_blockable(range))
374+ might_sleep();
375+
371376 if (mm_has_notifiers(range->mm))
372377 __mmu_notifier_invalidate_range_end(range, false);
373378 }

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