* The test for existing mappings in vm_remove_consumer() was a bit too aggressive;

if the page is currently copied, the source page still has mappings.
* vm_copy_on_write_area() did not set the cache type for the upper cache.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20530 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2007-04-03 11:23:37 +00:00
parent 48e0491d5a
commit 1407f23d9b
2 changed files with 12 additions and 5 deletions

View File

@ -1586,6 +1586,7 @@ vm_copy_on_write_area(vm_area *area)
// we need to hold the cache_ref lock when we want to switch its cache
mutex_lock(&lowerCacheRef->lock);
upperCache->type = CACHE_TYPE_RAM;
upperCache->temporary = 1;
upperCache->scan_skip = lowerCache->scan_skip;
upperCache->virtual_base = lowerCache->virtual_base;

View File

@ -528,16 +528,22 @@ vm_cache_remove_consumer(vm_cache_ref *cacheRef, vm_cache *consumer)
cache, cacheRef->ref_count, consumer));
for (page = cache->page_list; page != NULL; page = nextPage) {
vm_page *consumerPage;
nextPage = page->cache_next;
if (vm_cache_lookup_page(consumerRef,
(off_t)page->cache_offset << PAGE_SHIFT) == NULL) {
// the page already is not yet in the consumer cache - move it upwards
consumerPage = vm_cache_lookup_page(consumerRef,
(off_t)page->cache_offset << PAGE_SHIFT);
if (consumerPage == NULL) {
// the page already is not yet in the consumer cache - move
// it upwards
vm_cache_remove_page(cacheRef, page);
vm_cache_insert_page(consumerRef, page,
(off_t)page->cache_offset << PAGE_SHIFT);
} else if (page->mappings != 0 || page->wired_count != 0)
panic("page %p has still mappings!", page);
} else if (consumerPage->state != PAGE_STATE_BUSY
&& (page->mappings != 0 || page->wired_count != 0)) {
panic("page %p has still mappings (consumer cache %p)!",
page, consumerRef);
}
}
newSource = cache->source;