summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authordyson <dyson@FreeBSD.org>1995-10-23 03:49:43 +0000
committerdyson <dyson@FreeBSD.org>1995-10-23 03:49:43 +0000
commiteca6c1d9071f4f2d6fd60abc77434cb5c8c704f6 (patch)
treea4c5c0e3896279ce0d055bda78065aad34770917 /sys
parent770c343ca51517e46d159086b34446ef17252027 (diff)
downloadFreeBSD-src-eca6c1d9071f4f2d6fd60abc77434cb5c8c704f6.zip
FreeBSD-src-eca6c1d9071f4f2d6fd60abc77434cb5c8c704f6.tar.gz
First phase of removing the PG_COPYONWRITE flag, and an architectural
cleanup of mapping files.
Diffstat (limited to 'sys')
-rw-r--r--sys/vm/vm_fault.c10
-rw-r--r--sys/vm/vm_mmap.c53
-rw-r--r--sys/vm/vm_object.c11
3 files changed, 19 insertions, 55 deletions
diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c
index 23e0961..efd63fa 100644
--- a/sys/vm/vm_fault.c
+++ b/sys/vm/vm_fault.c
@@ -66,7 +66,7 @@
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
- * $Id: vm_fault.c,v 1.32 1995/09/24 19:47:58 dyson Exp $
+ * $Id: vm_fault.c,v 1.33 1995/10/07 19:02:53 davidg Exp $
*/
/*
@@ -532,7 +532,6 @@ readrest:
object->paging_in_progress++;
} else {
prot &= ~VM_PROT_WRITE;
- m->flags |= PG_COPYONWRITE;
}
}
@@ -590,19 +589,12 @@ readrest:
* write-enabled after all.
*/
prot &= retry_prot;
- if (m->flags & PG_COPYONWRITE)
- prot &= ~VM_PROT_WRITE;
}
/*
* (the various bits we're fiddling with here are locked by the
* object's lock)
*/
- /* XXX This distorts the meaning of the copy_on_write bit */
-
- if (prot & VM_PROT_WRITE)
- m->flags &= ~PG_COPYONWRITE;
-
/*
* It's critically important that a wired-down page be faulted only
* once in each map for which it is wired.
diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c
index fb955fe..fed73e0 100644
--- a/sys/vm/vm_mmap.c
+++ b/sys/vm/vm_mmap.c
@@ -38,7 +38,7 @@
* from: Utah $Hdr: vm_mmap.c 1.6 91/10/21$
*
* @(#)vm_mmap.c 8.4 (Berkeley) 1/12/94
- * $Id: vm_mmap.c,v 1.26 1995/07/13 08:48:31 davidg Exp $
+ * $Id: vm_mmap.c,v 1.27 1995/10/21 17:42:28 dyson Exp $
*/
/*
@@ -636,50 +636,31 @@ vm_mmap(map, addr, size, prot, maxprot, flags, handle, foff)
if (object == NULL)
return (type == OBJT_DEVICE ? EINVAL : ENOMEM);
- /*
- * Anonymous memory, shared file, or character special file.
- */
- if ((flags & (MAP_ANON|MAP_SHARED)) || (type == OBJT_DEVICE)) {
- rv = vm_map_find(map, object, foff, addr, size, fitit);
- if (rv != KERN_SUCCESS) {
- /*
- * Lose the object reference. Will destroy the
- * object if it's an unnamed anonymous mapping
- * or named anonymous without other references.
- */
- vm_object_deallocate(object);
- goto out;
- }
+ rv = vm_map_find(map, object, foff, addr, size, fitit);
+ if (rv != KERN_SUCCESS) {
+ /*
+ * Lose the object reference. Will destroy the
+ * object if it's an unnamed anonymous mapping
+ * or named anonymous without other references.
+ */
+ vm_object_deallocate(object);
+ goto out;
}
+
/*
* mmap a COW regular file
*/
- else {
+ if ((flags & (MAP_ANON|MAP_SHARED)) == 0 && (type != OBJT_DEVICE)) {
vm_map_entry_t entry;
- vm_object_t private_object;
-
- /*
- * Create a new object and make the original object
- * the backing object. NOTE: the object reference gained
- * above is now changed into the reference held by
- * private_object. Since we don't map 'object', we want
- * only this one reference.
- */
- private_object = vm_object_allocate(OBJT_DEFAULT, object->size);
- private_object->backing_object = object;
- TAILQ_INSERT_TAIL(&object->shadow_head,
- private_object, shadow_list);
-
- rv = vm_map_find(map, private_object, foff, addr, size, fitit);
- if (rv != KERN_SUCCESS) {
- vm_object_deallocate(private_object);
- goto out;
- }
-
if (!vm_map_lookup_entry(map, *addr, &entry)) {
panic("vm_mmap: missing map entry!!!");
}
entry->copy_on_write = TRUE;
+ /*
+ * This will create the processes private object on
+ * an as needed basis.
+ */
+ entry->needs_copy = TRUE;
/*
* set pages COW and protect for read access only
diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c
index 9a70cf1..b6f3954 100644
--- a/sys/vm/vm_object.c
+++ b/sys/vm/vm_object.c
@@ -61,7 +61,7 @@
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
- * $Id: vm_object.c,v 1.52 1995/08/16 16:14:28 bde Exp $
+ * $Id: vm_object.c,v 1.53 1995/08/26 23:19:48 bde Exp $
*/
/*
@@ -615,7 +615,6 @@ vm_object_pmap_copy(object, start, end)
for (p = object->memq.tqh_first; p != NULL; p = p->listq.tqe_next) {
if ((start <= p->offset) && (p->offset < end)) {
vm_page_protect(p, VM_PROT_READ);
- p->flags |= PG_COPYONWRITE;
}
}
}
@@ -709,14 +708,6 @@ vm_object_copy(src_object, src_offset, size,
*/
src_object->ref_count++;
- /*
- * Mark all of the pages copy-on-write.
- */
- for (p = src_object->memq.tqh_first; p; p = p->listq.tqe_next)
- if (src_offset <= p->offset &&
- p->offset < src_offset + size)
- p->flags |= PG_COPYONWRITE;
-
*dst_object = src_object;
*dst_offset = src_offset;
OpenPOWER on IntegriCloud