From 9226e1f0d8ad691ef140bc0bf9340efadb96e5fe Mon Sep 17 00:00:00 2001 From: Wenbo Zhang Date: Sun, 15 Dec 2019 07:26:45 -0500 Subject: [PATCH] fix opt.thp:never still use THP with base_new --- src/base.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/base.c b/src/base.c index f3c61661..9a55ed2e 100644 --- a/src/base.c +++ b/src/base.c @@ -39,6 +39,9 @@ base_map(tsdn_t *tsdn, extent_hooks_t *extent_hooks, unsigned ind, size_t size) size_t alignment = HUGEPAGE; if (extent_hooks == &extent_hooks_default) { addr = extent_alloc_mmap(NULL, size, alignment, &zero, &commit); + if (have_madvise_huge && addr) { + pages_set_thp_state(addr, size); + } } else { /* No arena context as we are creating new arenas. */ tsd_t *tsd = tsdn_null(tsdn) ? tsd_fetch() : tsdn_tsd(tsdn);