BoND directly maps all available physical memory into the PMAP area in the virtual address space for directly accessing physical memory.
Internally BoND segments the entire physical memory to 2 different Arenas (similar to Linux Zone).
BoND uses a bookkeeping structure mm_phys_page to represent each physical page (of different sizes). The kernel reserves a contiguous region in physical memory to store the structures of the entire physical memory. The region is accessed via the PMAP region.
BoND implements a buddy allocator on top of mm_phys_page to allocate physical page frames. The buddy allocator keeps free lists of pages of size 0 to MAX_ORDER. The free list of order n represents free pages with 2n times the kernel page size.
To allocate a page, the kernel first aligns up the requested size to order n. Then it tries to retrieve a page from the free list of order n. If the free list is empty, it checks the free list of n + 1. If the free list of order n + 1 contains free page frames, the kernel breaks one page frame of order n + 1 into two page frames of order n. These two pages are considered buddies. The kernel then returns one page frame to the caller and inserts the other one to the free list of order n. The operation is repeated until higher order free lists have at least one page frame.
To free a page frame of order n, the kernel simply inserts the page frame into the corresponding free list. It then checks the page frame's buddy (by aligning the address to order n + 1). If both page frames are free, the kernel merges them into a single page frame of higher order. The procedure is carried out recursively.