Added a heap_init_post_area() which is called right after areas can be
created, and moved the heap's grow and VIP heap initialization to it. Should fix #5956. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36855 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -71,6 +71,7 @@ void heap_set_get_caller(heap_allocator* heap, addr_t (*getCaller)());
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
status_t heap_init(addr_t heapBase, size_t heapSize);
|
status_t heap_init(addr_t heapBase, size_t heapSize);
|
||||||
|
status_t heap_init_post_area();
|
||||||
status_t heap_init_post_sem();
|
status_t heap_init_post_sem();
|
||||||
status_t heap_init_post_thread();
|
status_t heap_init_post_thread();
|
||||||
|
|
||||||
|
|||||||
+53
-46
@@ -2063,6 +2063,59 @@ heap_init(addr_t base, size_t size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
heap_init_post_area()
|
||||||
|
{
|
||||||
|
void *address = NULL;
|
||||||
|
area_id growHeapArea = create_area("dedicated grow heap", &address,
|
||||||
|
B_ANY_KERNEL_BLOCK_ADDRESS, HEAP_DEDICATED_GROW_SIZE, B_FULL_LOCK,
|
||||||
|
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
|
||||||
|
if (growHeapArea < 0) {
|
||||||
|
panic("heap_init_post_area(): couldn't allocate dedicate grow heap "
|
||||||
|
"area");
|
||||||
|
return growHeapArea;
|
||||||
|
}
|
||||||
|
|
||||||
|
sGrowHeap = heap_create_allocator("grow", (addr_t)address,
|
||||||
|
HEAP_DEDICATED_GROW_SIZE, &sHeapClasses[0], false);
|
||||||
|
if (sGrowHeap == NULL) {
|
||||||
|
panic("heap_init_post_area(): failed to create dedicated grow heap\n");
|
||||||
|
return B_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
// create the VIP heap
|
||||||
|
static const heap_class heapClass = {
|
||||||
|
"VIP I/O", /* name */
|
||||||
|
100, /* initial percentage */
|
||||||
|
B_PAGE_SIZE / 8, /* max allocation size */
|
||||||
|
B_PAGE_SIZE, /* page size */
|
||||||
|
8, /* min bin size */
|
||||||
|
4, /* bin alignment */
|
||||||
|
8, /* min count per page */
|
||||||
|
16 /* max waste per page */
|
||||||
|
};
|
||||||
|
|
||||||
|
area_id vipHeapArea = create_area("VIP heap", &address,
|
||||||
|
B_ANY_KERNEL_ADDRESS, VIP_HEAP_SIZE, B_FULL_LOCK,
|
||||||
|
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
|
||||||
|
if (vipHeapArea < 0) {
|
||||||
|
panic("heap_init_post_area(): couldn't allocate VIP heap area");
|
||||||
|
return B_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
sVIPHeap = heap_create_allocator("VIP heap", (addr_t)address,
|
||||||
|
VIP_HEAP_SIZE, &heapClass, false);
|
||||||
|
if (sVIPHeap == NULL) {
|
||||||
|
panic("heap_init_post_area(): failed to create VIP heap\n");
|
||||||
|
return B_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
dprintf("heap_init_post_area(): created VIP heap: %p\n", sVIPHeap);
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
heap_init_post_sem()
|
heap_init_post_sem()
|
||||||
{
|
{
|
||||||
@@ -2098,23 +2151,6 @@ status_t
|
|||||||
heap_init_post_thread()
|
heap_init_post_thread()
|
||||||
{
|
{
|
||||||
#if !USE_SLAB_ALLOCATOR_FOR_MALLOC
|
#if !USE_SLAB_ALLOCATOR_FOR_MALLOC
|
||||||
void *address = NULL;
|
|
||||||
area_id growHeapArea = create_area("dedicated grow heap", &address,
|
|
||||||
B_ANY_KERNEL_BLOCK_ADDRESS, HEAP_DEDICATED_GROW_SIZE, B_FULL_LOCK,
|
|
||||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
|
|
||||||
if (growHeapArea < 0) {
|
|
||||||
panic("heap_init_post_thread(): couldn't allocate dedicate grow heap "
|
|
||||||
"area");
|
|
||||||
return growHeapArea;
|
|
||||||
}
|
|
||||||
|
|
||||||
sGrowHeap = heap_create_allocator("grow", (addr_t)address,
|
|
||||||
HEAP_DEDICATED_GROW_SIZE, &sHeapClasses[0], false);
|
|
||||||
if (sGrowHeap == NULL) {
|
|
||||||
panic("heap_init_post_thread(): failed to create dedicated grow heap\n");
|
|
||||||
return B_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
sHeapGrowThread = spawn_kernel_thread(heap_grow_thread, "heap grower",
|
sHeapGrowThread = spawn_kernel_thread(heap_grow_thread, "heap grower",
|
||||||
B_URGENT_PRIORITY, NULL);
|
B_URGENT_PRIORITY, NULL);
|
||||||
if (sHeapGrowThread < 0) {
|
if (sHeapGrowThread < 0) {
|
||||||
@@ -2146,35 +2182,6 @@ heap_init_post_thread()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// create the VIP heap
|
|
||||||
static const heap_class heapClass = {
|
|
||||||
"VIP I/O", /* name */
|
|
||||||
100, /* initial percentage */
|
|
||||||
B_PAGE_SIZE / 8, /* max allocation size */
|
|
||||||
B_PAGE_SIZE, /* page size */
|
|
||||||
8, /* min bin size */
|
|
||||||
4, /* bin alignment */
|
|
||||||
8, /* min count per page */
|
|
||||||
16 /* max waste per page */
|
|
||||||
};
|
|
||||||
|
|
||||||
area_id vipHeapArea = create_area("VIP heap", &address,
|
|
||||||
B_ANY_KERNEL_ADDRESS, VIP_HEAP_SIZE, B_FULL_LOCK,
|
|
||||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
|
|
||||||
if (vipHeapArea < 0) {
|
|
||||||
panic("heap_init_post_thread(): couldn't allocate VIP heap area");
|
|
||||||
return B_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
sVIPHeap = heap_create_allocator("VIP heap", (addr_t)address,
|
|
||||||
VIP_HEAP_SIZE, &heapClass, false);
|
|
||||||
if (sVIPHeap == NULL) {
|
|
||||||
panic("heap_init_post_thread(): failed to create VIP heap\n");
|
|
||||||
return B_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
dprintf("heap_init_post_thread(): created VIP heap: %p\n", sVIPHeap);
|
|
||||||
|
|
||||||
resume_thread(sHeapGrowThread);
|
resume_thread(sHeapGrowThread);
|
||||||
|
|
||||||
#endif // !USE_SLAB_ALLOCATOR_FOR_MALLOC
|
#endif // !USE_SLAB_ALLOCATOR_FOR_MALLOC
|
||||||
|
|||||||
@@ -3608,6 +3608,10 @@ vm_init(kernel_args* args)
|
|||||||
VMAddressSpace::Init();
|
VMAddressSpace::Init();
|
||||||
reserve_boot_loader_ranges(args);
|
reserve_boot_loader_ranges(args);
|
||||||
|
|
||||||
|
#if !USE_SLAB_ALLOCATOR_FOR_MALLOC
|
||||||
|
heap_init_post_area();
|
||||||
|
#endif
|
||||||
|
|
||||||
// Do any further initialization that the architecture dependant layers may
|
// Do any further initialization that the architecture dependant layers may
|
||||||
// need now
|
// need now
|
||||||
arch_vm_translation_map_init_post_area(args);
|
arch_vm_translation_map_init_post_area(args);
|
||||||
|
|||||||
Reference in New Issue
Block a user