hugepage-rs
hugepage-rs wrapped allocator for linux hugepage.
Usage
HugePage Allocator
Hugepage allocator provides two interfaces for operation, hugepage_rs::alloc and hugepage_rs::dealloc, allocate and free hugepage memory.
The hugepage_rs::alloc() function allocates size bytes and returns a pointer to the allocated memory. The memory is not initialized. returns std::ptr::null_mut() if allocation fails, otherwise returns a pointer.
use hugepage_rs;
use Layout;
use ;
HugePage Boxed
Simple Box implementation with ownership, data on hugepage allocated memory, released directly after going out of scope, memory allocator using hugepage allocator.
use hugepage_rs;
fn main() {
let mut v = hugepage_rs::Box::new(5);
*v += 42;
assert_eq!(*v, 47);
}
Notes
- System need to enable hugepage.
Reference
Huge pages part 1 (Introduction)
Huge pages part 3: Administration
Huge pages part 4: benchmarking with huge pages
Huge pages part 5: A deeper look at TLBs and costs