summaryrefslogtreecommitdiffstats
path: root/src/jemalloc.c
diff options
context:
space:
mode:
authorQi Wang <interwq@gwu.edu>2017-08-24 21:29:28 (GMT)
committerQi Wang <interwq@gmail.com>2017-08-30 23:47:32 (GMT)
commit47b20bb6544de9cdd4ca7ab870d6ad257c0ce4ff (patch)
tree0c7a06a91a4c7988b9d95cbc0595c29403395fd9 /src/jemalloc.c
parentea91dfa58e11373748f747041c3041f72c9a7658 (diff)
downloadjemalloc-47b20bb6544de9cdd4ca7ab870d6ad257c0ce4ff.zip
jemalloc-47b20bb6544de9cdd4ca7ab870d6ad257c0ce4ff.tar.gz
jemalloc-47b20bb6544de9cdd4ca7ab870d6ad257c0ce4ff.tar.bz2
Change opt.metadata_thp to [disabled,auto,always].
To avoid the high RSS caused by THP + low usage arena (i.e. THP becomes a significant percentage), added a new "auto" option which will only start using THP after a base allocator used up the first THP region. Starting from the second hugepage (in a single arena), "auto" behaves the same as "always", i.e. madvise hugepage right away.
Diffstat (limited to 'src/jemalloc.c')
-rw-r--r--src/jemalloc.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/jemalloc.c b/src/jemalloc.c
index cbae259..3c0ea7d 100644
--- a/src/jemalloc.c
+++ b/src/jemalloc.c
@@ -1055,7 +1055,23 @@ malloc_conf_init(void) {
if (opt_abort_conf && had_conf_error) {
malloc_abort_invalid_conf();
}
- CONF_HANDLE_BOOL(opt_metadata_thp, "metadata_thp")
+ if (strncmp("metadata_thp", k, klen) == 0) {
+ int i;
+ bool match = false;
+ for (i = 0; i < metadata_thp_mode_limit; i++) {
+ if (strncmp(metadata_thp_mode_names[i],
+ v, vlen) == 0) {
+ opt_metadata_thp = i;
+ match = true;
+ break;
+ }
+ }
+ if (!match) {
+ malloc_conf_error("Invalid conf value",
+ k, klen, v, vlen);
+ }
+ continue;
+ }
CONF_HANDLE_BOOL(opt_retain, "retain")
if (strncmp("dss", k, klen) == 0) {
int i;