summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_fault.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/vm/vm_fault.c')
-rw-r--r--sys/vm/vm_fault.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c
index ca1ee1c..23e2ba0 100644
--- a/sys/vm/vm_fault.c
+++ b/sys/vm/vm_fault.c
@@ -779,15 +779,29 @@ readrest:
vm_page_flag_set(fs.m, PG_WRITEABLE);
vm_object_set_flag(fs.m->object,
OBJ_WRITEABLE|OBJ_MIGHTBEDIRTY);
+
/*
* If the fault is a write, we know that this page is being
- * written NOW. This will save on the pmap_is_modified() calls
- * later.
+ * written NOW so dirty it explicitly to save on
+ * pmap_is_modified() calls later.
+ *
+ * If this is a NOSYNC mmap we do not want to set PG_NOSYNC
+ * if the page is already dirty to prevent data written with
+ * the expectation of being synced from not being synced.
+ * Likewise if this entry does not request NOSYNC then make
+ * sure the page isn't marked NOSYNC. Applications sharing
+ * data should use the same flags to avoid ping ponging.
*
* Also tell the backing pager, if any, that it should remove
* any swap backing since the page is now dirty.
*/
if (fault_flags & VM_FAULT_DIRTY) {
+ if (fs.entry->eflags & MAP_ENTRY_NOSYNC) {
+ if (fs.m->dirty == 0)
+ vm_page_flag_set(fs.m, PG_NOSYNC);
+ } else {
+ vm_page_flag_clear(fs.m, PG_NOSYNC);
+ }
vm_page_dirty(fs.m);
vm_pager_page_unswapped(fs.m);
}
OpenPOWER on IntegriCloud