Large page support for FreeBSD (#74)

This commit is contained in:
tevador 2019-06-22 15:55:31 +02:00 committed by GitHub
parent 07293a9378
commit 118f3054ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -115,6 +115,8 @@ void* allocLargePagesMemory(std::size_t bytes) {
#else
#ifdef __APPLE__
mem = mmap(nullptr, bytes, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, VM_FLAGS_SUPERPAGE_SIZE_2MB, 0);
#elif defined(__FreeBSD__)
mem = mmap(nullptr, bytes, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_ALIGNED_SUPER, -1, 0);
#else
mem = mmap(nullptr, bytes, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB | MAP_POPULATE, -1, 0);
#endif