Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/mmap_unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ impl MmapRegion {
return Err(Error::Mmap(io::Error::last_os_error()));
}

let _ret = unsafe { libc::madvise(addr, size, libc::MADV_HUGEPAGE) };
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! Apologies for the late reply :( I was just wondering, what's the difference between using this madvise call and providing MAP_HUGETLB as part of flags?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAP_HUGETLB uses hugetlbfs, MADV_HUGEPAGE uses transparent huge page for memfd or anonymous mapping.


Ok(Self {
addr: addr as *mut u8,
size,
Expand Down