Skip to content

Commit

Permalink
Set MAP_POPULATE on guest mmap
Browse files Browse the repository at this point in the history
This directs the Linux kernel to set up page tables eagerly instead
of the default lazy behaviour, and shaves about 2 ms off the FreeBSD
kernel boot time.

Signed-off-by: Colin Percival <[email protected]>
  • Loading branch information
cperciva committed Jun 14, 2023
1 parent 9421770 commit 02d53a8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/vm-memory/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ pub fn create_guest_memory(

for region in regions {
let flags = match region.0 {
None => libc::MAP_NORESERVE | libc::MAP_PRIVATE | libc::MAP_ANONYMOUS,
None => libc::MAP_NORESERVE | libc::MAP_POPULATE | libc::MAP_PRIVATE | libc::MAP_ANONYMOUS,
Some(_) => libc::MAP_NORESERVE | libc::MAP_PRIVATE,
};

Expand Down

0 comments on commit 02d53a8

Please sign in to comment.