diff --git a/changelog/2565.added.md b/changelog/2565.added.md new file mode 100644 index 0000000000..5d476de128 --- /dev/null +++ b/changelog/2565.added.md @@ -0,0 +1,2 @@ +Add `sys::mman::MmapAdvise` `MADV_POPULATE_READ`, `MADV_POPULATE_WRITE` for Linux and Android targets + diff --git a/src/sys/mman.rs b/src/sys/mman.rs index 833e8e182d..6bd724379a 100644 --- a/src/sys/mman.rs +++ b/src/sys/mman.rs @@ -328,6 +328,13 @@ libc_enum! { /// Undo `MADV_WIPEONFORK` when it applied. #[cfg(linux_android)] MADV_KEEPONFORK, + /// Pre-load the address range for reading to reduce page-fault latency. + #[cfg(linux_android)] + MADV_POPULATE_READ, + /// Pre-fault the address range for writing to reduce page-fault + /// latency on subsequent writes. + #[cfg(linux_android)] + MADV_POPULATE_WRITE, } }