summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_map.c
diff options
context:
space:
mode:
authordyson <dyson@FreeBSD.org>1998-02-05 03:32:49 +0000
committerdyson <dyson@FreeBSD.org>1998-02-05 03:32:49 +0000
commitebccbfc1ff2783a90468a1caf1dcdec08e2cdfda (patch)
tree55a2e387681d3f8a086c24b5ee5f182df4318779 /sys/vm/vm_map.c
parentc552a9a1c3362d37fc1aaf3a9ba4231225b1f13a (diff)
downloadFreeBSD-src-ebccbfc1ff2783a90468a1caf1dcdec08e2cdfda.zip
FreeBSD-src-ebccbfc1ff2783a90468a1caf1dcdec08e2cdfda.tar.gz
1) Start using a cleaner and more consistant page allocator instead
of the various ad-hoc schemes. 2) When bringing in UPAGES, the pmap code needs to do another vm_page_lookup. 3) When appropriate, set the PG_A or PG_M bits a-priori to both avoid some processor errata, and to minimize redundant processor updating of page tables. 4) Modify pmap_protect so that it can only remove permissions (as it originally supported.) The additional capability is not needed. 5) Streamline read-only to read-write page mappings. 6) For pmap_copy_page, don't enable write mapping for source page. 7) Correct and clean-up pmap_incore. 8) Cluster initial kern_exec pagin. 9) Removal of some minor lint from kern_malloc. 10) Correct some ioopt code. 11) Remove some dead code from the MI swapout routine. 12) Correct vm_object_deallocate (to remove backing_object ref.) 13) Fix dead object handling, that had problems under heavy memory load. 14) Add minor vm_page_lookup improvements. 15) Some pages are not in objects, and make sure that the vm_page.c can properly support such pages. 16) Add some more page deficit handling. 17) Some minor code readability improvements.
Diffstat (limited to 'sys/vm/vm_map.c')
-rw-r--r--sys/vm/vm_map.c76
1 files changed, 11 insertions, 65 deletions
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c
index 6109761..574693d 100644
--- a/sys/vm/vm_map.c
+++ b/sys/vm/vm_map.c
@@ -61,7 +61,7 @@
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
- * $Id: vm_map.c,v 1.109 1998/01/31 11:56:38 dyson Exp $
+ * $Id: vm_map.c,v 1.110 1998/02/04 22:33:47 eivind Exp $
*/
/*
@@ -175,7 +175,6 @@ static void vm_map_entry_dispose __P((vm_map_t, vm_map_entry_t));
static void vm_map_entry_unwire __P((vm_map_t, vm_map_entry_t));
static void vm_map_copy_entry __P((vm_map_t, vm_map_t, vm_map_entry_t,
vm_map_entry_t));
-static vm_page_t vm_freeze_page_alloc __P((vm_object_t, vm_pindex_t));
void
vm_map_startup()
@@ -2608,27 +2607,6 @@ vm_uiomove(mapa, srcobject, cp, cnta, uaddra, npages)
}
/*
- * local routine to allocate a page for an object.
- */
-static vm_page_t
-vm_freeze_page_alloc(object, pindex)
- vm_object_t object;
- vm_pindex_t pindex;
-{
- vm_page_t m;
-
- while ((m = vm_page_alloc(object, pindex, VM_ALLOC_NORMAL)) == NULL) {
- VM_WAIT;
- if (m = vm_page_lookup(object, pindex))
- return NULL;
- }
-
- m->valid = 0;
- m->dirty = 0;
- return m;
-}
-
-/*
* Performs the copy_on_write operations necessary to allow the virtual copies
* into user space to work. This has to be called for write(2) system calls
* from other processes, file unlinking, and file size shrinkage.
@@ -2638,7 +2616,7 @@ vm_freeze_copyopts(object, froma, toa)
vm_object_t object;
vm_pindex_t froma, toa;
{
- int s;
+ int s, rv;
vm_object_t robject, robjectn;
vm_pindex_t idx, from, to;
@@ -2674,64 +2652,32 @@ vm_freeze_copyopts(object, froma, toa)
for (idx = 0; idx < robject->size; idx++) {
m_outretry:
- m_out = vm_page_lookup(robject, idx);
- if( m_out && (m_out->flags & PG_BUSY)) {
- s = splvm();
- while (m_out && (m_out->flags & PG_BUSY)) {
- m_out->flags |= PG_WANTED;
- tsleep(m_out, PVM, "pwtfrz", 0);
- splx(s);
- goto m_outretry;
- }
- splx(s);
- }
-
- if (m_out == NULL) {
- m_out = vm_freeze_page_alloc(robject, idx);
- if (m_out == NULL)
- goto m_outretry;
- }
+ m_out = vm_page_grab(robject, idx,
+ VM_ALLOC_NORMAL | VM_ALLOC_RETRY);
if (m_out->valid == 0) {
- m_out->flags |= PG_BUSY;
m_inretry:
- m_in = vm_page_lookup(object, bo_pindex + idx);
- if (m_in == NULL) {
- int rv;
- m_in = vm_freeze_page_alloc(object, bo_pindex + idx);
- if (m_in == NULL)
- goto m_inretry;
+ m_in = vm_page_grab(object, bo_pindex + idx,
+ VM_ALLOC_NORMAL | VM_ALLOC_RETRY);
+ if (m_in->valid == 0) {
rv = vm_pager_get_pages(object, &m_in, 1, 0);
if (rv != VM_PAGER_OK) {
printf("vm_freeze_copyopts: cannot read page from file: %x\n", m_in->pindex);
continue;
}
- } else if(m_in->busy || (m_in->flags & PG_BUSY)) {
- s = splvm();
- while (m_in && (m_in->busy || (m_in->flags & PG_BUSY))) {
- m_in->flags |= PG_WANTED;
- tsleep(m_in, PVM, "pwtfrz", 0);
- splx(s);
- goto m_inretry;
- }
- splx(s);
- if (m_in == NULL) {
- goto m_inretry;
- }
+ vm_page_deactivate(m_in);
}
- m_in->flags |= PG_BUSY;
vm_page_protect(m_in, VM_PROT_NONE);
pmap_copy_page(VM_PAGE_TO_PHYS(m_in), VM_PAGE_TO_PHYS(m_out));
- m_out->valid = VM_PAGE_BITS_ALL;
+ m_out->valid = m_in->valid;
m_out->dirty = VM_PAGE_BITS_ALL;
- vm_page_deactivate(m_out);
- vm_page_deactivate(m_in);
+ vm_page_activate(m_out);
- PAGE_WAKEUP(m_out);
PAGE_WAKEUP(m_in);
}
+ PAGE_WAKEUP(m_out);
}
object->shadow_count--;
OpenPOWER on IntegriCloud