Merge pull request #141 from dallasmarlow/master
only use MAP_HUGETLB when the kernel supports it
This commit is contained in:
commit
d08073aafc
@ -76,7 +76,7 @@ char* Arena::AllocateAligned(size_t bytes, size_t huge_page_tlb_size,
|
||||
assert((kAlignUnit & (kAlignUnit - 1)) ==
|
||||
0); // Pointer size should be a power of 2
|
||||
|
||||
#ifdef OS_LINUX
|
||||
#ifdef MAP_HUGETLB
|
||||
if (huge_page_tlb_size > 0 && bytes > 0) {
|
||||
// Allocate from a huge page TBL table.
|
||||
assert(logger != nullptr); // logger need to be passed in.
|
||||
@ -85,6 +85,7 @@ char* Arena::AllocateAligned(size_t bytes, size_t huge_page_tlb_size,
|
||||
assert(reserved_size >= bytes);
|
||||
void* addr = mmap(nullptr, reserved_size, (PROT_READ | PROT_WRITE),
|
||||
(MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB), 0, 0);
|
||||
|
||||
if (addr == MAP_FAILED) {
|
||||
Warn(logger, "AllocateAligned fail to allocate huge TLB pages: %s",
|
||||
strerror(errno));
|
||||
|
Loading…
Reference in New Issue
Block a user