From 4129f846032ae0cdec1fe55000520c1b87c11152 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Thu, 9 Oct 2008 12:11:49 +0000 Subject: [PATCH] - add team id on a TRACE() - try to accomodate for low ram systems by making the first kernel heap allocation smaller git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27943 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/vm/vm.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/system/kernel/vm/vm.cpp b/src/system/kernel/vm/vm.cpp index fc41e1e62d..6c11df27df 100644 --- a/src/system/kernel/vm/vm.cpp +++ b/src/system/kernel/vm/vm.cpp @@ -1642,7 +1642,7 @@ vm_create_anonymous_area(team_id team, const char *name, void **address, bool canOvercommit = false; addr_t physicalBase = 0; - TRACE(("create_anonymous_area %s: size 0x%lx\n", name, size)); + TRACE(("create_anonymous_area [%d] %s: size 0x%lx\n", team, name, size)); size = PAGE_ALIGN(size); @@ -4004,8 +4004,14 @@ vm_init(kernel_args *args) vm_page_init_num_pages(args); sAvailableMemory = vm_page_num_pages() * B_PAGE_SIZE; - // map in the new heap and initialize it size_t heapSize = INITIAL_HEAP_SIZE; + // try to accomodate low memory systems + while (heapSize > sAvailableMemory / 8) + heapSize /= 2; + if (heapSize < 1024 * 1024) + panic("vm_init: go buy some RAM please."); + + // map in the new heap and initialize it addr_t heapBase = vm_allocate_early(args, heapSize, heapSize, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA); TRACE(("heap at 0x%lx\n", heapBase));