1G huge page support using hugetlbfs
commitceb6776c5cec5ac341db3e28b3adf1c281f00152
authorBin Liu <binliu@fb.com>
Fri, 10 Jun 2016 03:11:53 +0000 (9 20:11 -0700)
committerHhvm Bot <hhvm-bot-bot@fb.com>
Fri, 10 Jun 2016 03:25:52 +0000 (9 20:25 -0700)
tree231884457876bcd232305a8e69ba0377927bcecd
parent77dca70e1680ce9135d463e3c1ea0335c96f7328
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
hphp/runtime/base/concurrent-shared-store.cpp
hphp/runtime/base/string-data.cpp
hphp/runtime/vm/class.cpp
hphp/runtime/vm/func.cpp
hphp/runtime/vm/unit.cpp
hphp/util/alloc.cpp
hphp/util/alloc.h
hphp/util/hugetlb.cpp [new file with mode: 0644]
hphp/util/hugetlb.h [new file with mode: 0644]
hphp/util/managed-arena.cpp [new file with mode: 0644]
hphp/util/managed-arena.h [new file with mode: 0644]