* 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 .
* 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
This commit is contained in:
Axel Dörfler 2007-08-15 23:11:15 +00:00
parent 6b9d63b18f
commit 066a557444
2 changed files with 9 additions and 9 deletions
src/system/kernel/vm

@ -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);

@ -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);