| .. | .. |
|---|
| 845 | 845 | return 1; |
|---|
| 846 | 846 | |
|---|
| 847 | 847 | /* |
|---|
| 848 | + * If the source mm belongs to a Dovetail-enabled process, we |
|---|
| 849 | + * don't want to impose the COW-induced latency on it: make |
|---|
| 850 | + * sure the child gets its own copy of the page. |
|---|
| 851 | + */ |
|---|
| 852 | + if (dovetailing() && test_bit(MMF_DOVETAILED, &src_mm->flags)) |
|---|
| 853 | + goto do_copy; |
|---|
| 854 | + |
|---|
| 855 | + /* |
|---|
| 848 | 856 | * What we want to do is to check whether this page may |
|---|
| 849 | 857 | * have been pinned by the parent process. If so, |
|---|
| 850 | 858 | * instead of wrprotect the pte on both sides, we copy |
|---|
| .. | .. |
|---|
| 862 | 870 | if (likely(!page_maybe_dma_pinned(page))) |
|---|
| 863 | 871 | return 1; |
|---|
| 864 | 872 | |
|---|
| 873 | +do_copy: |
|---|
| 865 | 874 | /* |
|---|
| 866 | 875 | * The vma->anon_vma of the child process may be NULL |
|---|
| 867 | 876 | * because the entire vma does not contain anonymous pages. |
|---|
| .. | .. |
|---|
| 5696 | 5705 | void __might_fault(const char *file, int line) |
|---|
| 5697 | 5706 | { |
|---|
| 5698 | 5707 | /* |
|---|
| 5708 | + * When running over the oob stage (e.g. some co-kernel's own |
|---|
| 5709 | + * thread), we should only make sure to run with hw IRQs |
|---|
| 5710 | + * enabled before accessing the memory. |
|---|
| 5711 | + */ |
|---|
| 5712 | + if (running_oob()) { |
|---|
| 5713 | + WARN_ON_ONCE(hard_irqs_disabled()); |
|---|
| 5714 | + return; |
|---|
| 5715 | + } |
|---|
| 5716 | + /* |
|---|
| 5699 | 5717 | * Some code (nfs/sunrpc) uses socket ops on kernel memory while |
|---|
| 5700 | 5718 | * holding the mmap_lock, this is safe because kernel memory doesn't |
|---|
| 5701 | 5719 | * get paged out, therefore we'll never actually fault, and the |
|---|