From 066a55744440bddbf1fa0e314131754681fa5b82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 15 Aug 2007 23:11:15 +0000 Subject: [PATCH] * vm_soft_fault() no longer sets all pages it touches to "active"; instead, it now honours if the page was already in the "modified" list before. Also, the source page (which is either mapped directly or copied to the target page) is no longer marked busy before its final destiny is decided (it didn't have any effect, anyway, since we had its cache locked for the whole time, but it now preserves the modified state). This fixes bug #1369. * vm_cache_write_modified() now filters out temporary caches (it's currently called on area deletion). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21971 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/vm/vm.cpp | 15 ++++++--------- src/system/kernel/vm/vm_cache.cpp | 3 +++ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/system/kernel/vm/vm.cpp b/src/system/kernel/vm/vm.cpp index 35d0fb3d58..491f71ba79 100644 --- a/src/system/kernel/vm/vm.cpp +++ b/src/system/kernel/vm/vm.cpp @@ -2389,7 +2389,9 @@ vm_map_page(vm_area *area, vm_page *page, addr_t address, uint32 protection) map->ops->unlock(map); - vm_page_set_state(page, PAGE_STATE_ACTIVE); + if (page->state != PAGE_STATE_MODIFIED) + vm_page_set_state(page, PAGE_STATE_ACTIVE); + return B_OK; } @@ -3570,13 +3572,7 @@ fault_find_page(vm_translation_map *map, vm_cache *topCache, for (;;) { page = vm_cache_lookup_page(cache, cacheOffset); if (page != NULL && page->state != PAGE_STATE_BUSY) { - // Note: We set the page state to busy, but we don't need a - // condition variable here, since we keep the cache locked - // till we mark the page unbusy again (in fault_get_page() - // the source page, or in vm_soft_fault() when mapping the - // page), so no one will ever know the page was busy in the - // first place. - vm_page_set_state(page, PAGE_STATE_BUSY); + // we found the page break; } if (page == NULL || page == &dummyPage) @@ -3861,7 +3857,8 @@ if (cacheOffset == 0x12000) map->ops->put_physical_page((addr_t)source); map->ops->put_physical_page((addr_t)dest); - vm_page_set_state(sourcePage, PAGE_STATE_ACTIVE); + if (sourcePage->state != PAGE_STATE_MODIFIED) + vm_page_set_state(sourcePage, PAGE_STATE_ACTIVE); mutex_unlock(&cache->lock); mutex_lock(&topCache->lock); diff --git a/src/system/kernel/vm/vm_cache.cpp b/src/system/kernel/vm/vm_cache.cpp index d25d6dce9c..c17d44a7c3 100644 --- a/src/system/kernel/vm/vm_cache.cpp +++ b/src/system/kernel/vm/vm_cache.cpp @@ -362,6 +362,9 @@ vm_cache_write_modified(vm_cache *cache, bool fsReenter) TRACE(("vm_cache_write_modified(cache = %p)\n", cache)); + if (cache->temporary) + return B_OK; + mutex_lock(&cache->lock); status = vm_page_write_modified(cache, fsReenter); mutex_unlock(&cache->lock);