Expand description
(deprecated) a simple stack based 4K physical frame allocator.
Adcantages
- allocation and deallocation is O(1).
- can manage fragmented (non-consecutive) memory regions and doesn’t suffer fragmentation because memory is fully virtualized.
Limitations
- slow initialization: needs to traverse all available pages and push their address one by one
- can’t give continous physical memory of more than 4K
- the allocator stack itself requires continous space (it’s an array), and
has a higher storage overhead: every page requires 8 bytes for the
address, that’s
8/4096 == 1/512
. - (kinda?) conflicts kmalloc/vmalloc design in e.g. linux kernel, kmalloc
manages the identically mapped virtual memory in the kernel address
space, that is
0xffff800000000000 + 64G
in rustubs, in another word, the kmalloc manages the physical memory: obviously this one only gives 4K memory and can’t work as a kmalloc backend!
Structs§
- There should only be one global instance of this.