hc
2024-11-01 2f529f9b558ca1c1bd74be7437a84e4711743404
kernel/mm/memory.c
....@@ -845,6 +845,14 @@
845845 return 1;
846846
847847 /*
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
+ /*
848856 * What we want to do is to check whether this page may
849857 * have been pinned by the parent process. If so,
850858 * instead of wrprotect the pte on both sides, we copy
....@@ -862,6 +870,7 @@
862870 if (likely(!page_maybe_dma_pinned(page)))
863871 return 1;
864872
873
+do_copy:
865874 /*
866875 * The vma->anon_vma of the child process may be NULL
867876 * because the entire vma does not contain anonymous pages.
....@@ -5696,6 +5705,15 @@
56965705 void __might_fault(const char *file, int line)
56975706 {
56985707 /*
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
+ /*
56995717 * Some code (nfs/sunrpc) uses socket ops on kernel memory while
57005718 * holding the mmap_lock, this is safe because kernel memory doesn't
57015719 * get paged out, therefore we'll never actually fault, and the