Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions tcmalloc/internal/system_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,15 @@ SystemAllocator<Topology, NormalPartitions>::MmapRegion::Alloc(
// This is only advisory, so ignore the error.
ErrnoRestorer errno_restorer;
(void)madvise(result_ptr, actual_size, MADV_NOHUGEPAGE);
} else {
// Opt-in to transparent hugepages for large allocations when system is
// configured for transparent_hugepage=madvise. This can improve memory
// performance by reducing TLB pressure.
if (actual_size >= kHugePageSize) {
// This is only advisory, so ignore the error.
ErrnoRestorer errno_restorer;
(void)madvise(result_ptr, actual_size, MADV_HUGEPAGE);
}
}
free_size_ -= actual_size;
return {result_ptr, actual_size};
Expand Down