mem: add comment explaining buddy allocator concept
This commit is contained in:
parent
4595f35e4f
commit
a1329f092b
1 changed files with 6 additions and 1 deletions
|
|
@ -89,7 +89,12 @@ static paddr_t buddy_get_slab(struct buddy_region_header *head, size_t depth, si
|
||||||
* Conceptually, the bitmap is a tree, where each node has two children, and is
|
* Conceptually, the bitmap is a tree, where each node has two children, and is
|
||||||
* laid out flat in memory.
|
* laid out flat in memory.
|
||||||
*
|
*
|
||||||
* The buddy allocator
|
* The buddy allocator checks within a pre-defined power-of-2 region for a free
|
||||||
|
* region of the requested size. If the region is the correct size, it allocates
|
||||||
|
* it, and if it finds one that is too small, it skips it. If the region found
|
||||||
|
* is too large, instead of skipping to the next, the allocator splits the
|
||||||
|
* region in half recursively until it is of the correct size, and marks the
|
||||||
|
* bitmap accordingly.
|
||||||
*/
|
*/
|
||||||
static paddr_t buddy_alloc_helper(struct buddy_region_header *head, size_t size)
|
static paddr_t buddy_alloc_helper(struct buddy_region_header *head, size_t size)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue