Struct kalloc::buddy::MultiBuddySystem [−][src]
pub struct MultiBuddySystem<P> { /* fields omitted */ }
Expand description
Allocator that holds multiple buddy systems.
Implementations
impl<P: Unsigned + PowerOfTwo + 'static> MultiBuddySystem<P>
[src]
impl<P: Unsigned + PowerOfTwo + 'static> MultiBuddySystem<P>
[src]pub unsafe fn add_zone(&mut self, begin: usize, end: usize)
[src]
pub unsafe fn add_zone(&mut self, begin: usize, end: usize)
[src]Add zone [begin, end) with page size into this allocator.
Note that size of the memory handled by one buddy system is requied to be a power of two. But this may waste a large amount of memory if it’s slightly smaller than a power of two. Thus, to make full use of the memory, we recursively build buddy systems on the memory left by previous buddy system and terminate when it fails to build.
This may add O(logN) buddy systems, where N = end - begin.
pub unsafe fn alloc1(&self, order: usize) -> *mut u8
[src]
pub unsafe fn alloc1(&self, order: usize) -> *mut u8
[src]Allocate memory of 2^order
pages.
Loop through every registered zone and try allocating. O(logN) per zone.