kernel/slab: Allocate one area upfront when the debug heaps are in use.

See inline comment: if we don't, we'll try to allocate pages
during the post-page-init but pre-area-init period, which
isn't possible (and after the previous commit will properly fail.)

Change-Id: If8392417e05912c8cfc417222abab3b39cb15bf1
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7700
Haiku-Format: Haiku-format Bot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Augustin Cavalier
2024-05-29 18:10:06 +00:00
committed by waddlesplash
parent ebc1a034fb
commit 7133a49e81
+10
View File
@@ -445,6 +445,16 @@ MemoryManager::Init(kernel_args* args)
sFreeAreas = NULL;
sFreeAreaCount = 0;
sMaintenanceNeeded = false;
#if USE_DEBUG_HEAP_FOR_MALLOC || USE_GUARDED_HEAP_FOR_MALLOC
// Allocate one area immediately. Otherwise, we might try to allocate before
// post-area initialization but after page initialization, during which time
// we can't actually reserve pages.
MutexLocker locker(sLock);
Area* area = NULL;
_AllocateArea(0, area);
_AddArea(area);
#endif
}