Is there a way to pre-populate the operating system page table for a large Rust allocation?
If you try to allocate a large chunk of memory using any of Rust's memory allocators (including nightly alloc_api
), you cannot prepopulate the page table, that is, you cannot recreate the MAP_POPULATE option for mmap. Instead, I just use libc::mmap
it when I need to allocate large areas of memory.
Is there any other way to pre-populate a page table in Rust other than scrolling through Vec<usize>
or Vec<SomeTypeOfPageSize>
and page launch error?
As @FlorianWeimer noted , there are platform-specific ways to accomplish this. I am scanning the Rust RFC to see if the new allocator API includes any presets.
source to share