diff options
author | alc <alc@FreeBSD.org> | 2003-03-06 03:41:02 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2003-03-06 03:41:02 +0000 |
commit | c50367da676eaa300253058b5594f783a3db948b (patch) | |
tree | 333a33c08a22ccf64aa091f047218641fdbb343a /sys/vm | |
parent | 9ecf925a7d952716f0fd6c5a64b072a3caee80af (diff) | |
download | FreeBSD-src-c50367da676eaa300253058b5594f783a3db948b.zip FreeBSD-src-c50367da676eaa300253058b5594f783a3db948b.tar.gz |
Remove ENABLE_VFS_IOOPT. It is a long unfinished work-in-progress.
Discussed on: arch@
Diffstat (limited to 'sys/vm')
-rw-r--r-- | sys/vm/vm_fault.c | 7 | ||||
-rw-r--r-- | sys/vm/vm_map.c | 249 | ||||
-rw-r--r-- | sys/vm/vm_map.h | 1 | ||||
-rw-r--r-- | sys/vm/vm_object.c | 134 | ||||
-rw-r--r-- | sys/vm/vm_object.h | 4 | ||||
-rw-r--r-- | sys/vm/vnode_pager.c | 3 |
6 files changed, 0 insertions, 398 deletions
diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index abb9ef3..e443a00 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -280,13 +280,6 @@ RetryFault:; fs.vp = vnode_pager_lock(fs.first_object); vm_object_pip_add(fs.first_object, 1); -#ifdef ENABLE_VFS_IOOPT - if ((fault_type & VM_PROT_WRITE) && - (fs.first_object->type == OBJT_VNODE)) { - vm_freeze_copyopts(fs.first_object, - fs.first_pindex, fs.first_pindex + 1); - } -#endif fs.lookup_still_valid = TRUE; if (wired) diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index cd3b2e7..33e819d 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -2879,255 +2879,6 @@ vm_map_lookup_done(vm_map_t map, vm_map_entry_t entry) vm_map_unlock_read(map); } -#ifdef ENABLE_VFS_IOOPT -/* - * Experimental support for zero-copy I/O - * - * Implement uiomove with VM operations. This handles (and collateral changes) - * support every combination of source object modification, and COW type - * operations. - */ -int -vm_uiomove( - vm_map_t mapa, - vm_object_t srcobject, - off_t cp, - int cnta, - vm_offset_t uaddra, - int *npages) -{ - vm_map_t map; - vm_object_t first_object, oldobject, object; - vm_map_entry_t entry; - vm_prot_t prot; - boolean_t wired; - int tcnt, rv; - vm_offset_t uaddr, start, end, tend; - vm_pindex_t first_pindex, oindex; - vm_size_t osize; - off_t ooffset; - int cnt; - - GIANT_REQUIRED; - - if (npages) - *npages = 0; - - cnt = cnta; - uaddr = uaddra; - - while (cnt > 0) { - map = mapa; - - if ((vm_map_lookup(&map, uaddr, - VM_PROT_READ, &entry, &first_object, - &first_pindex, &prot, &wired)) != KERN_SUCCESS) { - return EFAULT; - } - - vm_map_clip_start(map, entry, uaddr); - - tcnt = cnt; - tend = uaddr + tcnt; - if (tend > entry->end) { - tcnt = entry->end - uaddr; - tend = entry->end; - } - - vm_map_clip_end(map, entry, tend); - - start = entry->start; - end = entry->end; - - osize = atop(tcnt); - - oindex = OFF_TO_IDX(cp); - if (npages) { - vm_size_t idx; - for (idx = 0; idx < osize; idx++) { - vm_page_t m; - if ((m = vm_page_lookup(srcobject, oindex + idx)) == NULL) { - vm_map_lookup_done(map, entry); - return 0; - } - /* - * disallow busy or invalid pages, but allow - * m->busy pages if they are entirely valid. - */ - if ((m->flags & PG_BUSY) || - ((m->valid & VM_PAGE_BITS_ALL) != VM_PAGE_BITS_ALL)) { - vm_map_lookup_done(map, entry); - return 0; - } - } - } - -/* - * If we are changing an existing map entry, just redirect - * the object, and change mappings. - */ - if ((first_object->type == OBJT_VNODE) && - ((oldobject = entry->object.vm_object) == first_object)) { - - if ((entry->offset != cp) || (oldobject != srcobject)) { - /* - * Remove old window into the file - */ - vm_page_lock_queues(); - pmap_remove(map->pmap, uaddr, tend); - vm_page_unlock_queues(); - - /* - * Force copy on write for mmaped regions - */ - vm_object_pmap_copy_1 (srcobject, oindex, oindex + osize); - - /* - * Point the object appropriately - */ - if (oldobject != srcobject) { - - /* - * Set the object optimization hint flag - */ - vm_object_set_flag(srcobject, OBJ_OPT); - vm_object_reference(srcobject); - entry->object.vm_object = srcobject; - - if (oldobject) { - vm_object_deallocate(oldobject); - } - } - - entry->offset = cp; - map->timestamp++; - } else { - vm_page_lock_queues(); - pmap_remove(map->pmap, uaddr, tend); - vm_page_unlock_queues(); - } - - } else if ((first_object->ref_count == 1) && - (first_object->size == osize) && - ((first_object->type == OBJT_DEFAULT) || - (first_object->type == OBJT_SWAP)) ) { - - oldobject = first_object->backing_object; - - if ((first_object->backing_object_offset != cp) || - (oldobject != srcobject)) { - /* - * Remove old window into the file - */ - vm_page_lock_queues(); - pmap_remove(map->pmap, uaddr, tend); - vm_page_unlock_queues(); - - /* - * Remove unneeded old pages - */ - vm_object_lock(first_object); - vm_object_page_remove(first_object, 0, 0, 0); - vm_object_unlock(first_object); - - /* - * Invalidate swap space - */ - if (first_object->type == OBJT_SWAP) { - swap_pager_freespace(first_object, - 0, - first_object->size); - } - - /* - * Force copy on write for mmaped regions - */ - vm_object_pmap_copy_1 (srcobject, oindex, oindex + osize); - - /* - * Point the object appropriately - */ - if (oldobject != srcobject) { - /* - * Set the object optimization hint flag - */ - vm_object_set_flag(srcobject, OBJ_OPT); - vm_object_reference(srcobject); - - if (oldobject) { - TAILQ_REMOVE(&oldobject->shadow_head, - first_object, shadow_list); - oldobject->shadow_count--; - /* XXX bump generation? */ - vm_object_deallocate(oldobject); - } - - TAILQ_INSERT_TAIL(&srcobject->shadow_head, - first_object, shadow_list); - srcobject->shadow_count++; - /* XXX bump generation? */ - - first_object->backing_object = srcobject; - } - first_object->backing_object_offset = cp; - map->timestamp++; - } else { - vm_page_lock_queues(); - pmap_remove(map->pmap, uaddr, tend); - vm_page_unlock_queues(); - } -/* - * Otherwise, we have to do a logical mmap. - */ - } else { - - vm_object_set_flag(srcobject, OBJ_OPT); - vm_object_reference(srcobject); - - vm_page_lock_queues(); - pmap_remove(map->pmap, uaddr, tend); - vm_page_unlock_queues(); - - vm_object_pmap_copy_1 (srcobject, oindex, oindex + osize); - vm_map_lock_upgrade(map); - - if (entry == &map->header) { - map->first_free = &map->header; - } else if (map->first_free->start >= start) { - map->first_free = entry->prev; - } - - vm_map_entry_delete(map, entry); - - object = srcobject; - ooffset = cp; - - rv = vm_map_insert(map, object, ooffset, start, tend, - VM_PROT_ALL, VM_PROT_ALL, MAP_COPY_ON_WRITE); - - if (rv != KERN_SUCCESS) - panic("vm_uiomove: could not insert new entry: %d", rv); - } - -/* - * Map the window directly, if it is already in memory - */ - pmap_object_init_pt(map->pmap, uaddr, - srcobject, oindex, tcnt, 0); - - map->timestamp++; - vm_map_unlock(map); - - cnt -= tcnt; - uaddr += tcnt; - cp += tcnt; - if (npages) - *npages += osize; - } - return 0; -} -#endif - #include "opt_ddb.h" #ifdef DDB #include <sys/kernel.h> diff --git a/sys/vm/vm_map.h b/sys/vm/vm_map.h index 3809d06..eef9a48 100644 --- a/sys/vm/vm_map.h +++ b/sys/vm/vm_map.h @@ -322,6 +322,5 @@ int vm_map_unwire(vm_map_t map, vm_offset_t start, vm_offset_t end, int vm_map_wire(vm_map_t map, vm_offset_t start, vm_offset_t end, boolean_t user_wire); int vmspace_swap_count (struct vmspace *vmspace); -int vm_uiomove(vm_map_t, vm_object_t, off_t, int, vm_offset_t, int *); #endif /* _KERNEL */ #endif /* _VM_MAP_ */ diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 2fe605d..b51987b 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -407,9 +407,6 @@ vm_object_vndeallocate(vm_object_t object) if (object->ref_count == 0) { mp_fixme("Unlocked vflag access."); vp->v_vflag &= ~VV_TEXT; -#ifdef ENABLE_VFS_IOOPT - vm_object_clear_flag(object, OBJ_OPT); -#endif } /* * vrele may need a vop lock @@ -502,10 +499,6 @@ doterm: if (temp) { TAILQ_REMOVE(&temp->shadow_head, object, shadow_list); temp->shadow_count--; -#ifdef ENABLE_VFS_IOOPT - if (temp->ref_count == 0) - vm_object_clear_flag(temp, OBJ_OPT); -#endif temp->generation++; object->backing_object = NULL; } @@ -556,12 +549,6 @@ vm_object_terminate(vm_object_t object) if (object->type == OBJT_VNODE) { struct vnode *vp; -#ifdef ENABLE_VFS_IOOPT - /* - * Freeze optimized copies. - */ - vm_freeze_copyopts(object, 0, object->size); -#endif /* * Clean pages and flush buffers. */ @@ -937,39 +924,6 @@ vm_object_page_collect_flush(vm_object_t object, vm_page_t p, int curgeneration, return(maxf + 1); } -#ifdef ENABLE_VFS_IOOPT -/* - * Same as vm_object_pmap_copy, except range checking really - * works, and is meant for small sections of an object. - * - * This code protects resident pages by making them read-only - * and is typically called on a fork or split when a page - * is converted to copy-on-write. - * - * NOTE: If the page is already at VM_PROT_NONE, calling - * pmap_page_protect will have no effect. - */ -void -vm_object_pmap_copy_1(vm_object_t object, vm_pindex_t start, vm_pindex_t end) -{ - vm_pindex_t idx; - vm_page_t p; - - GIANT_REQUIRED; - - if (object == NULL || (object->flags & OBJ_WRITEABLE) == 0) - return; - vm_page_lock_queues(); - for (idx = start; idx < end; idx++) { - p = vm_page_lookup(object, idx); - if (p == NULL) - continue; - pmap_page_protect(p, VM_PROT_READ); - } - vm_page_unlock_queues(); -} -#endif - /* * vm_object_madvise: * @@ -1852,94 +1806,6 @@ vm_object_set_writeable_dirty(vm_object_t object) } } -#ifdef ENABLE_VFS_IOOPT -/* - * Experimental support for zero-copy I/O - * - * 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. - */ -void -vm_freeze_copyopts(vm_object_t object, vm_pindex_t froma, vm_pindex_t toa) -{ - int rv; - vm_object_t robject; - vm_pindex_t idx; - - GIANT_REQUIRED; - if ((object == NULL) || - ((object->flags & OBJ_OPT) == 0)) - return; - - if (object->shadow_count > object->ref_count) - panic("vm_freeze_copyopts: sc > rc"); - - while ((robject = TAILQ_FIRST(&object->shadow_head)) != NULL) { - vm_pindex_t bo_pindex; - vm_page_t m_in, m_out; - - bo_pindex = OFF_TO_IDX(robject->backing_object_offset); - - vm_object_reference(robject); - - vm_object_pip_wait(robject, "objfrz"); - - if (robject->ref_count == 1) { - vm_object_deallocate(robject); - continue; - } - - vm_object_pip_add(robject, 1); - - for (idx = 0; idx < robject->size; idx++) { - - m_out = vm_page_grab(robject, idx, - VM_ALLOC_NORMAL | VM_ALLOC_RETRY); - - if (m_out->valid == 0) { - m_in = vm_page_grab(object, bo_pindex + idx, - VM_ALLOC_NORMAL | VM_ALLOC_RETRY); - vm_page_lock_queues(); - if (m_in->valid == 0) { - vm_page_unlock_queues(); - rv = vm_pager_get_pages(object, &m_in, 1, 0); - if (rv != VM_PAGER_OK) { - printf("vm_freeze_copyopts: cannot read page from file: %lx\n", (long)m_in->pindex); - continue; - } - vm_page_lock_queues(); - vm_page_deactivate(m_in); - } - - pmap_remove_all(m_in); - vm_page_unlock_queues(); - pmap_copy_page(m_in, m_out); - vm_page_lock_queues(); - m_out->valid = m_in->valid; - vm_page_dirty(m_out); - vm_page_activate(m_out); - vm_page_wakeup(m_in); - } else - vm_page_lock_queues(); - vm_page_wakeup(m_out); - vm_page_unlock_queues(); - } - - object->shadow_count--; - object->ref_count--; - TAILQ_REMOVE(&object->shadow_head, robject, shadow_list); - robject->backing_object = NULL; - robject->backing_object_offset = 0; - - vm_object_pip_wakeup(robject); - vm_object_deallocate(robject); - } - - vm_object_clear_flag(object, OBJ_OPT); -} -#endif - #include "opt_ddb.h" #ifdef DDB #include <sys/kernel.h> diff --git a/sys/vm/vm_object.h b/sys/vm/vm_object.h index 1716e35..467d7f0 100644 --- a/sys/vm/vm_object.h +++ b/sys/vm/vm_object.h @@ -151,7 +151,6 @@ struct vm_object { #define OBJ_WRITEABLE 0x0080 /* object has been made writable */ #define OBJ_MIGHTBEDIRTY 0x0100 /* object might be dirty */ #define OBJ_CLEANING 0x0200 -#define OBJ_OPT 0x1000 /* I/O optimization */ #define OBJ_ONEMAPPING 0x2000 /* One USE (a single, non-forked) mapping flag */ #define IDX_TO_OFF(idx) (((vm_ooffset_t)(idx)) << PAGE_SHIFT) @@ -176,8 +175,6 @@ extern vm_object_t kmem_object; #define vm_object_unlock(object) \ mtx_unlock((object) == kmem_object ? &kmem_object->mtx : &Giant) -void vm_freeze_copyopts(vm_object_t, vm_pindex_t, vm_pindex_t); - void vm_object_set_flag(vm_object_t object, u_short bits); void vm_object_clear_flag(vm_object_t object, u_short bits); void vm_object_pip_add(vm_object_t object, short i); @@ -199,7 +196,6 @@ void vm_object_set_writeable_dirty (vm_object_t); void vm_object_init (void); void vm_object_page_clean (vm_object_t, vm_pindex_t, vm_pindex_t, boolean_t); void vm_object_page_remove (vm_object_t, vm_pindex_t, vm_pindex_t, boolean_t); -void vm_object_pmap_copy_1 (vm_object_t, vm_pindex_t, vm_pindex_t); void vm_object_reference (vm_object_t); void vm_object_shadow (vm_object_t *, vm_ooffset_t *, vm_size_t); void vm_object_split(vm_map_entry_t); diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index f061ccb..5522bcb 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -307,9 +307,6 @@ vnode_pager_setsize(vp, nsize) * File has shrunk. Toss any cached pages beyond the new EOF. */ if (nsize < object->un_pager.vnp.vnp_size) { -#ifdef ENABLE_VFS_IOOPT - vm_freeze_copyopts(object, OFF_TO_IDX(nsize), object->size); -#endif if (nobjsize < object->size) { vm_object_lock(object); vm_object_page_remove(object, nobjsize, object->size, |