Allocate memory for the DEBUG_CACHE_LIST debug feature only when there's

plenty available.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36634 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2010-05-05 21:18:46 +00:00
parent 3735d4e299
commit 7b926f5135
1 changed files with 17 additions and 11 deletions

View File

@ -3652,11 +3652,13 @@ vm_init(kernel_args* args)
object_cache_set_minimum_reserve(gPageMappingsObjectCache, 1024); object_cache_set_minimum_reserve(gPageMappingsObjectCache, 1024);
#if DEBUG_CACHE_LIST #if DEBUG_CACHE_LIST
if (vm_page_num_free_pages() >= 200 * 1024 * 1024 / B_PAGE_SIZE) {
create_area_etc(VMAddressSpace::KernelID(), "cache info table", create_area_etc(VMAddressSpace::KernelID(), "cache info table",
(void**)&sCacheInfoTable, B_ANY_KERNEL_ADDRESS, (void**)&sCacheInfoTable, B_ANY_KERNEL_ADDRESS,
ROUNDUP(kCacheInfoTableCount * sizeof(cache_info), B_PAGE_SIZE), ROUNDUP(kCacheInfoTableCount * sizeof(cache_info), B_PAGE_SIZE),
B_FULL_LOCK, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, 0, B_FULL_LOCK, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, 0,
CREATE_AREA_DONT_WAIT); CREATE_AREA_DONT_WAIT);
}
#endif // DEBUG_CACHE_LIST #endif // DEBUG_CACHE_LIST
// add some debugger commands // add some debugger commands
@ -3666,12 +3668,16 @@ vm_init(kernel_args* args)
add_debugger_command("cache", &dump_cache, "Dump VMCache"); add_debugger_command("cache", &dump_cache, "Dump VMCache");
add_debugger_command("cache_tree", &dump_cache_tree, "Dump VMCache tree"); add_debugger_command("cache_tree", &dump_cache_tree, "Dump VMCache tree");
#if DEBUG_CACHE_LIST #if DEBUG_CACHE_LIST
if (sCacheInfoTable != NULL) {
add_debugger_command_etc("caches", &dump_caches, add_debugger_command_etc("caches", &dump_caches,
"List all VMCache trees", "List all VMCache trees",
"[ \"-c\" ]\n" "[ \"-c\" ]\n"
"All cache trees are listed sorted in decreasing order by number of\n" "All cache trees are listed sorted in decreasing order by number "
"used pages or, if \"-c\" is specified, by size of committed memory.\n", "of\n"
"used pages or, if \"-c\" is specified, by size of committed "
"memory.\n",
0); 0);
}
#endif #endif
add_debugger_command("avail", &dump_available_memory, add_debugger_command("avail", &dump_available_memory,
"Dump available memory"); "Dump available memory");