1G huge page support using hugetlbfs
Summary:
This diff does three things to use 1G huge pages in HHVM.
(1) Allocating memory backed by hugetlbfs with 1G page size using mmap(), and optionally pin the memory to a NUMA node. To allow minimal configuration, we support automatically discovery of a hugetlbfs mount point, and if such a mount point doesn't exist, try to mount() one if reserved 1G pages are discovered.
(2) Utility to use the allocated huge pages for malloc(), based on jemalloc chunk hooks.
(3) Try to create jemalloc arenas for huge pages during program initialization, and partially replace low_malloc() in a bunch of places. This is fail safe.
The utility could be expanded later to include functionalities such as reporting huge page usage on each node, and unmap a page when appropriate.
Clearly, it only works on Linux and with jemalloc. This work is done together with nsun, who showed me how to use hugetlbfs.
Reviewed By: jasone
Differential Revision:
D3386907
fbshipit-source-id:
c1689148b67270b06e783d17ae5e4f65ca0bc954