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
343static inline void343static inline void
344mmu_notifier_invalidate_range_start(struct mmu_notifier_range *range)344mmu_notifier_invalidate_range_start(struct mmu_notifier_range *range)
345{345{
346 might_sleep();
347
346 lock_map_acquire(&__mmu_notifier_invalidate_range_start_map);348 lock_map_acquire(&__mmu_notifier_invalidate_range_start_map);
347 if (mm_has_notifiers(range->mm)) {349 if (mm_has_notifiers(range->mm)) {
348 range->flags |= MMU_NOTIFIER_RANGE_BLOCKABLE;350 range->flags |= MMU_NOTIFIER_RANGE_BLOCKABLE;
@@ -368,6 +370,9 @@ mmu_notifier_invalidate_range_start_nonblock(struct mmu_notifier_range *range) · 19 unmodified lines
368static inline void370static inline void
369mmu_notifier_invalidate_range_end(struct mmu_notifier_range *range)371mmu_notifier_invalidate_range_end(struct mmu_notifier_range *range)
370{372{
373 if (mmu_notifier_range_blockable(range))
374 might_sleep();
375
371 if (mm_has_notifiers(range->mm))376 if (mm_has_notifiers(range->mm))
372 __mmu_notifier_invalidate_range_end(range, false);377 __mmu_notifier_invalidate_range_end(range, false);
373}378}

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