summaryrefslogtreecommitdiffstats
path: root/sys/kern/sys_process.c
diff options
context:
space:
mode:
authorups <ups@FreeBSD.org>2007-11-08 19:35:36 +0000
committerups <ups@FreeBSD.org>2007-11-08 19:35:36 +0000
commitc6c6cc7efad7de66468002a16796bccf2d80c119 (patch)
tree122f0a9e8bacc31f21995b7ba2602e10122a7617 /sys/kern/sys_process.c
parenta38a20f6ddd4addcf92e96efa1e54e68049c4589 (diff)
downloadFreeBSD-src-c6c6cc7efad7de66468002a16796bccf2d80c119.zip
FreeBSD-src-c6c6cc7efad7de66468002a16796bccf2d80c119.tar.gz
Use VM_FAULT_DIRTY to fault in pages for write access in
proc_rwmen. Otherwise copy on write may create an anonymous page that is not marked as dirty. Since writing data to these pages in this function also does not dirty these pages they may be later discarded by the pagedaemon.
Diffstat (limited to 'sys/kern/sys_process.c')
-rw-r--r--sys/kern/sys_process.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c
index ff9640a..432138c 100644
--- a/sys/kern/sys_process.c
+++ b/sys/kern/sys_process.c
@@ -216,7 +216,7 @@ proc_rwmem(struct proc *p, struct uio *uio)
vm_object_t backing_object, object = NULL;
vm_offset_t pageno = 0; /* page number */
vm_prot_t reqprot;
- int error, writing;
+ int error, fault_flags, writing;
/*
* Assert that someone has locked this vmspace. (Should be
@@ -234,6 +234,7 @@ proc_rwmem(struct proc *p, struct uio *uio)
writing = uio->uio_rw == UIO_WRITE;
reqprot = writing ? (VM_PROT_WRITE | VM_PROT_OVERRIDE_WRITE) :
VM_PROT_READ;
+ fault_flags = writing ? VM_FAULT_DIRTY : VM_FAULT_NORMAL;
/*
* Only map in one page at a time. We don't have to, but it
@@ -268,7 +269,7 @@ proc_rwmem(struct proc *p, struct uio *uio)
/*
* Fault the page on behalf of the process
*/
- error = vm_fault(map, pageno, reqprot, VM_FAULT_NORMAL);
+ error = vm_fault(map, pageno, reqprot, fault_flags);
if (error) {
error = EFAULT;
break;
OpenPOWER on IntegriCloud