PAGE_TYPE_GUARD was unused and for the other two types a simple one bit flag

suffices. Therefore replaced vm_page::type by vm_page::is_dummy.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35013 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2010-01-11 19:13:14 +00:00
parent 5084d83333
commit 451ca8b4b4
3 changed files with 12 additions and 18 deletions

View File

@ -94,21 +94,16 @@ struct vm_page {
vint32 accessing_thread;
#endif
uint8 type : 2;
uint8 is_dummy : 1;
uint8 state : 3;
uint8 busy_writing : 1;
uint8 unused : 2;
// used in VMAnonymousCache::Merge()
uint8 unused : 3;
int8 usage_count;
uint16 wired_count;
};
enum {
PAGE_TYPE_PHYSICAL = 0,
PAGE_TYPE_DUMMY,
PAGE_TYPE_GUARD
};
enum {
PAGE_STATE_ACTIVE = 0,

View File

@ -2767,16 +2767,15 @@ dump_cache(int argc, char** argv)
if (showPages) {
for (VMCachePagesTree::Iterator it = cache->pages.GetIterator();
vm_page* page = it.Next();) {
if (page->type == PAGE_TYPE_PHYSICAL) {
kprintf("\t%p ppn 0x%lx offset 0x%lx type %u state %u (%s) "
if (!page->is_dummy) {
kprintf("\t%p ppn 0x%lx offset 0x%lx state %u (%s) "
"wired_count %u\n", page, page->physical_page_number,
page->cache_offset, page->type, page->state,
page->cache_offset, page->state,
page_state_to_string(page->state), page->wired_count);
} else if(page->type == PAGE_TYPE_DUMMY) {
} else {
kprintf("\t%p DUMMY PAGE state %u (%s)\n",
page, page->state, page_state_to_string(page->state));
} else
kprintf("\t%p UNKNOWN PAGE type %u\n", page, page->type);
}
}
} else
kprintf("\t%ld in cache\n", cache->page_count);

View File

@ -408,7 +408,7 @@ dump_page(int argc, char **argv)
kprintf("cache: %p\n", page->cache);
kprintf("cache_offset: %ld\n", page->cache_offset);
kprintf("cache_next: %p\n", page->cache_next);
kprintf("type: %d\n", page->type);
kprintf("is dummy: %d\n", page->is_dummy);
kprintf("state: %s\n", page_state_to_string(page->state));
kprintf("wired_count: %d\n", page->wired_count);
kprintf("usage_count: %d\n", page->usage_count);
@ -861,7 +861,7 @@ page_scrubber(void *unused)
static inline bool
is_marker_page(struct vm_page *page)
{
return page->type == PAGE_TYPE_DUMMY;
return page->is_dummy;
}
@ -1359,7 +1359,7 @@ page_writer(void* /*unused*/)
}
vm_page marker;
marker.type = PAGE_TYPE_DUMMY;
marker.is_dummy = true;
marker.cache = NULL;
marker.state = PAGE_STATE_UNUSED;
#if DEBUG_PAGE_QUEUE
@ -1586,7 +1586,7 @@ steal_pages(vm_page **pages, size_t count)
{
while (true) {
vm_page marker;
marker.type = PAGE_TYPE_DUMMY;
marker.is_dummy = true;
marker.cache = NULL;
marker.state = PAGE_STATE_UNUSED;
#if DEBUG_PAGE_QUEUE
@ -1884,7 +1884,7 @@ vm_page_init(kernel_args *args)
// initialize the free page table
for (uint32 i = 0; i < sNumPages; i++) {
sPages[i].physical_page_number = sPhysicalPageOffset + i;
sPages[i].type = PAGE_TYPE_PHYSICAL;
sPages[i].is_dummy = false;
sPages[i].state = PAGE_STATE_FREE;
new(&sPages[i].mappings) vm_page_mappings();
sPages[i].wired_count = 0;