Date: Mon, 26 Jan 2009 00:52:10 +0000 (UTC) From: Alan Cox <alc@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r187701 - user/alc/zerocopy/sys/vm Message-ID: <200901260052.n0Q0qAWN031905@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: alc Date: Mon Jan 26 00:52:09 2009 New Revision: 187701 URL: http://svn.freebsd.org/changeset/base/187701 Log: Retire the page-based copy-on-write mechanism. Modified: user/alc/zerocopy/sys/vm/vm_fault.c user/alc/zerocopy/sys/vm/vm_page.c user/alc/zerocopy/sys/vm/vm_page.h Modified: user/alc/zerocopy/sys/vm/vm_fault.c ============================================================================== --- user/alc/zerocopy/sys/vm/vm_fault.c Sun Jan 25 23:08:47 2009 (r187700) +++ user/alc/zerocopy/sys/vm/vm_fault.c Mon Jan 26 00:52:09 2009 (r187701) @@ -330,25 +330,6 @@ RetryFault:; */ fs.m = vm_page_lookup(fs.object, fs.pindex); if (fs.m != NULL) { - /* - * check for page-based copy on write. - * We check fs.object == fs.first_object so - * as to ensure the legacy COW mechanism is - * used when the page in question is part of - * a shadow object. Otherwise, vm_page_cowfault() - * removes the page from the backing object, - * which is not what we want. - */ - vm_page_lock_queues(); - if ((fs.m->cow) && - (fault_type & VM_PROT_WRITE) && - (fs.object == fs.first_object)) { - vm_page_cowfault(fs.m); - vm_page_unlock_queues(); - unlock_and_deallocate(&fs); - goto RetryFault; - } - /* * Wait/Retry if the page is busy. We have to do this * if the page is busy via either VPO_BUSY or @@ -366,7 +347,6 @@ RetryFault:; * to pmap it. */ if ((fs.m->oflags & VPO_BUSY) || fs.m->busy) { - vm_page_unlock_queues(); VM_OBJECT_UNLOCK(fs.object); if (fs.object != fs.first_object) { VM_OBJECT_LOCK(fs.first_object); @@ -398,6 +378,7 @@ RetryFault:; vm_object_deallocate(fs.first_object); goto RetryFault; } + vm_page_lock_queues(); vm_pageq_remove(fs.m); vm_page_unlock_queues(); Modified: user/alc/zerocopy/sys/vm/vm_page.c ============================================================================== --- user/alc/zerocopy/sys/vm/vm_page.c Sun Jan 25 23:08:47 2009 (r187700) +++ user/alc/zerocopy/sys/vm/vm_page.c Mon Jan 26 00:52:09 2009 (r187701) @@ -2033,98 +2033,6 @@ vm_page_test_dirty(vm_page_t m) } } -int so_zerocp_fullpage = 0; - -/* - * Replace the given page with a copy. The copied page assumes - * the portion of the given page's "wire_count" that is not the - * responsibility of this copy-on-write mechanism. - * - * The object containing the given page must have a non-zero - * paging-in-progress count and be locked. - */ -void -vm_page_cowfault(vm_page_t m) -{ - vm_page_t mnew; - vm_object_t object; - vm_pindex_t pindex; - - object = m->object; - VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); - KASSERT(object->paging_in_progress != 0, - ("vm_page_cowfault: object %p's paging-in-progress count is zero.", - object)); - pindex = m->pindex; - - retry_alloc: - pmap_remove_all(m); - vm_page_remove(m); - mnew = vm_page_alloc(object, pindex, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY); - if (mnew == NULL) { - vm_page_insert(m, object, pindex); - vm_page_unlock_queues(); - VM_OBJECT_UNLOCK(object); - VM_WAIT; - VM_OBJECT_LOCK(object); - if (m == vm_page_lookup(object, pindex)) { - vm_page_lock_queues(); - goto retry_alloc; - } else { - /* - * Page disappeared during the wait. - */ - vm_page_lock_queues(); - return; - } - } - - if (m->cow == 0) { - /* - * check to see if we raced with an xmit complete when - * waiting to allocate a page. If so, put things back - * the way they were - */ - vm_page_free(mnew); - vm_page_insert(m, object, pindex); - } else { /* clear COW & copy page */ - if (!so_zerocp_fullpage) - pmap_copy_page(m, mnew); - mnew->valid = VM_PAGE_BITS_ALL; - vm_page_dirty(mnew); - mnew->wire_count = m->wire_count - m->cow; - m->wire_count = m->cow; - } -} - -void -vm_page_cowclear(vm_page_t m) -{ - - mtx_assert(&vm_page_queue_mtx, MA_OWNED); - if (m->cow) { - m->cow--; - /* - * let vm_fault add back write permission lazily - */ - } - /* - * sf_buf_free() will free the page, so we needn't do it here - */ -} - -int -vm_page_cowsetup(vm_page_t m) -{ - - mtx_assert(&vm_page_queue_mtx, MA_OWNED); - if (m->cow == USHRT_MAX - 1) - return (EBUSY); - m->cow++; - pmap_remove_write(m); - return (0); -} - #include "opt_ddb.h" #ifdef DDB #include <sys/kernel.h> Modified: user/alc/zerocopy/sys/vm/vm_page.h ============================================================================== --- user/alc/zerocopy/sys/vm/vm_page.h Sun Jan 25 23:08:47 2009 (r187700) +++ user/alc/zerocopy/sys/vm/vm_page.h Mon Jan 26 00:52:09 2009 (r187701) @@ -115,7 +115,6 @@ struct vm_page { u_short flags; /* see below */ uint8_t order; /* index of the buddy queue */ uint8_t pool; - u_short cow; /* page cow mapping count */ u_int wire_count; /* wired down maps refs (P) */ short hold_count; /* page hold count */ u_short oflags; /* page flags (O) */ @@ -335,9 +334,6 @@ int vm_page_bits (int, int); void vm_page_zero_invalid(vm_page_t m, boolean_t setvalid); void vm_page_free_toq(vm_page_t m); void vm_page_zero_idle_wakeup(void); -void vm_page_cowfault (vm_page_t); -int vm_page_cowsetup(vm_page_t); -void vm_page_cowclear (vm_page_t); /* * vm_page_sleep_if_busy:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200901260052.n0Q0qAWN031905>