Tiered allocators #73
Labels
area/alloc
Area: this issue concerns memory allocation.
area/kernel
Area: this issue relates to the core kernel.
kind/feature
Kind: this issue is a feature.
kind/refactor
Kind: this issue describes refactoring or code quality improvement.
As I rewrite the kernel memory allocator, I should think about incorporating some notion of tiering. We could start with a simple bump pointer allocator early in the init process, and use that for allocating heap objects that live as long as the kernel does (and will never need to be deallocated), and wait to set up the buddy-block allocator until after we've remapped the kernel into the higher address space (since the buddy allocator seems to break occasionally when our paging setup is incomplete).
There's precedent for this sort of tiered allocation scheme; the Linux kernel starts out with a bump pointer allocator at boot time.
We could use an enum to encode one-way allocator state transitions in the type system, so that once the system allocator has been upgraded to the buddy-block allocator, there's no way for it to "go back".
In addition to tiering the system allocator for Rust collections, we should be able to compose slab allocators on top of the main allocator, for constructing specific object types. We should use these slab allocators for kernel objects that we need to allocate a large number of.
The text was updated successfully, but these errors were encountered: