Skip to content

Commit

Permalink
Merge pull request #227 from devnexen/nothp
Browse files Browse the repository at this point in the history
adding THP_PAGES option to disable transparent huge pages.
  • Loading branch information
struct authored Apr 21, 2024
2 parents eb1f3f2 + 2cdac95 commit e4d1a35
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ MALLOC_HOOK = -DMALLOC_HOOK=1
## Use Huge pages for any allocation that is a multiple
## of 2 megabytes. See PERFORMANCE.md for additional info
HUGE_PAGES = -DHUGE_PAGES=1
THP_PAGES = -DTHP_PAGES=1

## Enable the built-in heap profiler. When this is enabled
## IsoAlloc will write a file to disk upon exit of the
Expand Down Expand Up @@ -316,7 +317,7 @@ endif
CFLAGS += $(COMMON_CFLAGS) $(DISABLE_CANARY) $(BUILD_ERROR_FLAGS) $(HOOKS) $(HEAP_PROFILER) -fvisibility=hidden \
-std=$(STDC) $(SANITIZER_SUPPORT) $(ALLOC_SANITY) $(MEMCPY_SANITY) $(UNINIT_READ_SANITY) $(CPU_PIN) $(SCHED_GETCPU) \
$(EXPERIMENTAL) $(UAF_PTR_PAGE) $(VERIFY_FREE_BIT_SLOTS) $(NAMED_MAPPINGS) $(ABORT_ON_NULL) $(NO_ZERO_ALLOCATIONS) \
$(ABORT_NO_ENTROPY) $(ISO_DTOR_CLEANUP) $(RANDOMIZE_FREELIST) $(USE_SPINLOCK) $(HUGE_PAGES) $(USE_MLOCK) \
$(ABORT_NO_ENTROPY) $(ISO_DTOR_CLEANUP) $(RANDOMIZE_FREELIST) $(USE_SPINLOCK) $(HUGE_PAGES) ${THP_PAGES} $(USE_MLOCK) \
$(MEMORY_TAGGING) $(STRONG_SIZE_ISOLATION) $(MEMSET_SANITY) $(AUTO_CTOR_DTOR) $(SIGNAL_HANDLER) \
$(BIG_ZONE_META_DATA_GUARD) $(BIG_ZONE_GUARD) $(PROTECT_UNUSED_BIG_ZONE) $(MASK_PTRS) $(SANITIZE_CHUNKS) $(FUZZ_MODE) \
$(PERM_FREE_REALLOC) $(ARM_MTE) $(DONT_USE_NEON)
Expand Down
2 changes: 1 addition & 1 deletion src/iso_alloc_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ void *mmap_pages(size_t size, bool populate, const char *name, int32_t prot) {
LOG_AND_ABORT("Failed to mmap rw pages");
}

#if __linux__ && MAP_HUGETLB && HUGE_PAGES && MADV_HUGEPAGE
#if __linux__ && MAP_HUGETLB && HUGE_PAGES && THP_PAGES && MADV_HUGEPAGE
if(sz == ZONE_USER_SIZE || sz == (ZONE_USER_SIZE >> 1)) {
madvise(p, sz, MADV_HUGEPAGE);
}
Expand Down

0 comments on commit e4d1a35

Please sign in to comment.