Added more checks regarding page movement for debugging purposes.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20468 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
6da6433598
commit
673a63dc41
@ -3511,6 +3511,7 @@ vm_soft_fault(addr_t originalAddress, bool isWrite, bool isUser)
|
||||
|
||||
vm_translation_map *map = &addressSpace->translation_map;
|
||||
vm_page dummyPage;
|
||||
dummyPage.cache = NULL;
|
||||
dummyPage.state = PAGE_STATE_INACTIVE;
|
||||
dummyPage.type = PAGE_TYPE_DUMMY;
|
||||
|
||||
|
@ -269,6 +269,9 @@ vm_cache_lookup_page(vm_cache_ref *cacheRef, off_t offset)
|
||||
release_spinlock(&sPageCacheTableLock);
|
||||
restore_interrupts(state);
|
||||
|
||||
if (page != NULL && cacheRef->cache != page->cache)
|
||||
panic("page %p not in cache %p\n", page, cacheRef->cache);
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
@ -278,9 +281,15 @@ vm_cache_insert_page(vm_cache_ref *cacheRef, vm_page *page, off_t offset)
|
||||
{
|
||||
cpu_status state;
|
||||
|
||||
TRACE(("vm_cache_insert_page: cacheRef %p, page %p, offset %Ld\n", cacheRef, page, offset));
|
||||
TRACE(("vm_cache_insert_page: cacheRef %p, page %p, offset %Ld\n",
|
||||
cacheRef, page, offset));
|
||||
ASSERT_LOCKED_MUTEX(&cacheRef->lock);
|
||||
|
||||
if (page->cache != NULL) {
|
||||
panic("insert page %p into cache %p: page cache is set to %p\n",
|
||||
page, cacheRef->cache, page->cache);
|
||||
}
|
||||
|
||||
page->cache_offset = (uint32)(offset >> PAGE_SHIFT);
|
||||
|
||||
if (cacheRef->cache->page_list != NULL)
|
||||
@ -300,7 +309,6 @@ vm_cache_insert_page(vm_cache_ref *cacheRef, vm_page *page, off_t offset)
|
||||
|
||||
release_spinlock(&sPageCacheTableLock);
|
||||
restore_interrupts(state);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -317,6 +325,9 @@ vm_cache_remove_page(vm_cache_ref *cacheRef, vm_page *page)
|
||||
TRACE(("vm_cache_remove_page: cache %p, page %p\n", cacheRef, page));
|
||||
ASSERT_LOCKED_MUTEX(&cacheRef->lock);
|
||||
|
||||
if (page->cache != cacheRef->cache)
|
||||
panic("remove page from %p: page cache is set to %p\n", cacheRef->cache, page->cache);
|
||||
|
||||
state = disable_interrupts();
|
||||
acquire_spinlock(&sPageCacheTableLock);
|
||||
|
||||
|
@ -349,6 +349,15 @@ set_page_state_nolock(vm_page *page, int pageState)
|
||||
panic("vm_page_set_state: vm_page %p in invalid state %d\n", page, page->state);
|
||||
}
|
||||
|
||||
if (page->state == PAGE_STATE_CLEAR || page->state == PAGE_STATE_FREE) {
|
||||
if (page->cache != NULL)
|
||||
panic("free page %p has cache", page);
|
||||
}
|
||||
if (pageState == PAGE_STATE_CLEAR || pageState == PAGE_STATE_FREE) {
|
||||
if (page->cache != NULL)
|
||||
panic("to be freed page %p has cache", page);
|
||||
}
|
||||
|
||||
switch (pageState) {
|
||||
case PAGE_STATE_BUSY:
|
||||
case PAGE_STATE_ACTIVE:
|
||||
@ -738,6 +747,7 @@ vm_page_init(kernel_args *args)
|
||||
sPages[i].mappings = NULL;
|
||||
sPages[i].wired_count = 0;
|
||||
sPages[i].usage_count = 0;
|
||||
sPages[i].cache = NULL;
|
||||
enqueue_page(&page_free_queue, &sPages[i]);
|
||||
}
|
||||
|
||||
@ -942,6 +952,8 @@ vm_page_allocate_page(int page_state)
|
||||
panic("vm_allocate_page: out of memory! page state = %d\n", page_state);
|
||||
}
|
||||
}
|
||||
if (p->cache != NULL)
|
||||
panic("supposed to be free page %p has cache\n", p);
|
||||
|
||||
old_page_state = p->state;
|
||||
p->state = PAGE_STATE_BUSY;
|
||||
|
Loading…
Reference in New Issue
Block a user