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:
parent
3735d4e299
commit
7b926f5135
@ -3652,11 +3652,13 @@ vm_init(kernel_args* args)
|
||||
object_cache_set_minimum_reserve(gPageMappingsObjectCache, 1024);
|
||||
|
||||
#if DEBUG_CACHE_LIST
|
||||
create_area_etc(VMAddressSpace::KernelID(), "cache info table",
|
||||
(void**)&sCacheInfoTable, B_ANY_KERNEL_ADDRESS,
|
||||
ROUNDUP(kCacheInfoTableCount * sizeof(cache_info), B_PAGE_SIZE),
|
||||
B_FULL_LOCK, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, 0,
|
||||
CREATE_AREA_DONT_WAIT);
|
||||
if (vm_page_num_free_pages() >= 200 * 1024 * 1024 / B_PAGE_SIZE) {
|
||||
create_area_etc(VMAddressSpace::KernelID(), "cache info table",
|
||||
(void**)&sCacheInfoTable, B_ANY_KERNEL_ADDRESS,
|
||||
ROUNDUP(kCacheInfoTableCount * sizeof(cache_info), B_PAGE_SIZE),
|
||||
B_FULL_LOCK, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, 0,
|
||||
CREATE_AREA_DONT_WAIT);
|
||||
}
|
||||
#endif // DEBUG_CACHE_LIST
|
||||
|
||||
// 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_tree", &dump_cache_tree, "Dump VMCache tree");
|
||||
#if DEBUG_CACHE_LIST
|
||||
add_debugger_command_etc("caches", &dump_caches,
|
||||
"List all VMCache trees",
|
||||
"[ \"-c\" ]\n"
|
||||
"All cache trees are listed sorted in decreasing order by number of\n"
|
||||
"used pages or, if \"-c\" is specified, by size of committed memory.\n",
|
||||
0);
|
||||
if (sCacheInfoTable != NULL) {
|
||||
add_debugger_command_etc("caches", &dump_caches,
|
||||
"List all VMCache trees",
|
||||
"[ \"-c\" ]\n"
|
||||
"All cache trees are listed sorted in decreasing order by number "
|
||||
"of\n"
|
||||
"used pages or, if \"-c\" is specified, by size of committed "
|
||||
"memory.\n",
|
||||
0);
|
||||
}
|
||||
#endif
|
||||
add_debugger_command("avail", &dump_available_memory,
|
||||
"Dump available memory");
|
||||
|
Loading…
Reference in New Issue
Block a user