Commit b9176fc5 authored by Felix Handte's avatar Felix Handte Committed by Facebook GitHub Bot

Fix FreeBSD Build for Huge Page Allocator

Summary:
I don't really understand how FreeBSD allocates huge pages. There doesn't seem
to be any explicit mechanism to ask for them, other than `MAP_ALIGNED_SUPER`
which should just make the allocation aligned correctly? At any rate, this
should build and return FreeBSD to basically the way it worked before.

Fixes #1622.

Reviewed By: davidtgoldblatt

Differential Revision: D29915224

fbshipit-source-id: 9c5973714bd6ad3d1f0c6f3969ccdd23f17114e7
parent 480538b2
......@@ -186,10 +186,12 @@ bool HugePageArena::setup_next_pages(uintptr_t upto) {
return false;
}
#if !defined(__FreeBSD__)
// Tell the kernel to please give us huge pages for this range
if (madvise((void*)curPtr, len, MADV_HUGEPAGE) != 0) {
return false;
}
#endif
// Make this memory accessible.
if (mprotect((void*)curPtr, len, PROT_READ | PROT_WRITE) != 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment