* map_backing_store() did not set the private mapping's cache to CACHE_TYPE_RAM.

* Some more debug helpers.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20469 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2007-03-30 09:45:50 +00:00
parent 673a63dc41
commit 94d37a4b51
3 changed files with 19 additions and 10 deletions

View File

@ -546,6 +546,7 @@ map_backing_store(vm_address_space *addressSpace, vm_cache_ref *cacheRef,
}
newCacheRef = newCache->ref;
newCache->type = CACHE_TYPE_RAM;
newCache->temporary = 1;
newCache->scan_skip = cache->scan_skip;
@ -1474,8 +1475,8 @@ _vm_put_area(vm_area *area, bool aspaceLocked)
vm_address_space *addressSpace;
bool removeit = false;
//TRACE(("_vm_put_area(area = %p, aspaceLocked = %s)\n",
// area, aspaceLocked ? "yes" : "no"));
TRACE(("_vm_put_area(area = %p, aspaceLocked = %s)\n",
area, aspaceLocked ? "yes" : "no"));
// we should never get here, but if we do, we can handle it
if (area->id == RESERVED_AREA_ID)
@ -3514,6 +3515,7 @@ vm_soft_fault(addr_t originalAddress, bool isWrite, bool isUser)
dummyPage.cache = NULL;
dummyPage.state = PAGE_STATE_INACTIVE;
dummyPage.type = PAGE_TYPE_DUMMY;
dummyPage.wired_count = 0;
vm_cache_ref *pageSourceRef;
vm_page *page = fault_get_page(map, topCacheRef, cacheOffset, isWrite,

View File

@ -182,6 +182,10 @@ vm_cache_release_ref(vm_cache_ref *cacheRef)
#if 0
{
// count min references to see if everything is okay
struct stack_frame {
struct stack_frame* previous;
void* return_address;
};
int32 min = 0;
vm_area *a;
vm_cache *c;
@ -194,8 +198,9 @@ vm_cache_release_ref(vm_cache_ref *cacheRef)
min++;
for (c = NULL; (c = list_get_next_item(&cacheRef->cache->consumers, c)) != NULL; )
min++;
dprintf("! %ld release cache_ref %p, ref_count is now %ld (min %ld, called from %p)\n", find_thread(NULL), cacheRef, cacheRef->ref_count,
min, ((struct stack_frame *)x86_read_ebp())->return_address);
dprintf("! %ld release cache_ref %p, ref_count is now %ld (min %ld, called from %p)\n",
find_thread(NULL), cacheRef, cacheRef->ref_count,
min, ((struct stack_frame *)x86_read_ebp())->return_address);
if (cacheRef->ref_count < min)
panic("cache_ref %p has too little ref_count!!!!", cacheRef);
if (locked)
@ -223,6 +228,11 @@ dprintf("! %ld release cache_ref %p, ref_count is now %ld (min %ld, called from
page = page->cache_next;
if (oldPage->mappings != NULL || oldPage->wired_count != 0) {
panic("remove page %p from cache %p: page still has mappings!\n",
oldPage, cacheRef->cache);
}
// remove it from the hash table
state = disable_interrupts();
acquire_spinlock(&sPageCacheTableLock);
@ -526,10 +536,8 @@ vm_cache_remove_consumer(vm_cache_ref *cacheRef, vm_cache *consumer)
vm_cache_remove_page(cacheRef, page);
vm_cache_insert_page(consumerRef, page,
(off_t)page->cache_offset << PAGE_SHIFT);
}
// TODO: if we'd remove the pages in the cache, we'd also
// need to remove all of their mappings!
} else if (page->mappings != 0 || page->wired_count != 0)
panic("page %p has still mappings!", page);
}
newSource = cache->source;

View File

@ -185,7 +185,6 @@ dump_page(int argc, char **argv)
kprintf("cache: %p\n", page->cache);
kprintf("cache_offset: %ld\n", page->cache_offset);
kprintf("cache_next,prev: %p, %p\n", page->cache_next, page->cache_prev);
kprintf("mappings: %p\n", page->mappings);
kprintf("type: %d\n", page->type);
kprintf("state: %d\n", page->state);
kprintf("wired_count: %u\n", page->wired_count);
@ -194,7 +193,7 @@ dump_page(int argc, char **argv)
mapping = page->mappings;
while (mapping != NULL) {
kprintf(" %p\n", mapping->area);
kprintf(" %p (%#lx)\n", mapping->area, mapping->area->id);
mapping = mapping->page_link.next;
}