Skip to content

Commit 5479c11

Browse files
v-gogtecopybara-github
authored andcommitted
Add experiment flag that hugepages' cold heap.
PiperOrigin-RevId: 816942326 Change-Id: I432f870abe29a50f9de2a00bdba7692200e6a19e
1 parent 9b4d2fd commit 5479c11

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

tcmalloc/experiment_config.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ enum class Experiment : int {
2929
TEST_ONLY_MM_VCPU, // TODO: b/245776120 - Complete experiment.
3030
TEST_ONLY_TCMALLOC_EXTENDED_PRIORITY_LISTS_V1, // TODO: b/437412600 - Complete experiment.
3131
TEST_ONLY_TCMALLOC_HUGE_CACHE_RELEASE_30S, // TODO: b/319872040 - Complete experiment.
32+
TEST_ONLY_TCMALLOC_MADV_COLD_HUGEPAGE, // TODO: b/450368905 - Complete experiment.
3233
TEST_ONLY_TCMALLOC_POW2_SIZECLASS,
3334
TEST_ONLY_TCMALLOC_PREFERENTIAL_COLLAPSE, // TODO: b/435257627 - Complete experiment.
3435
TEST_ONLY_TCMALLOC_REUSE_SIZE_CLASSES_V2, // TODO: b/358126781 - Complete experiment.
@@ -52,6 +53,7 @@ inline constexpr ExperimentConfig experiments[] = {
5253
{Experiment::TEST_ONLY_MM_VCPU, "TEST_ONLY_MM_VCPU"},
5354
{Experiment::TEST_ONLY_TCMALLOC_EXTENDED_PRIORITY_LISTS_V1, "TEST_ONLY_TCMALLOC_EXTENDED_PRIORITY_LISTS_V1"},
5455
{Experiment::TEST_ONLY_TCMALLOC_HUGE_CACHE_RELEASE_30S, "TEST_ONLY_TCMALLOC_HUGE_CACHE_RELEASE_30S"},
56+
{Experiment::TEST_ONLY_TCMALLOC_MADV_COLD_HUGEPAGE, "TEST_ONLY_TCMALLOC_MADV_COLD_HUGEPAGE"},
5557
{Experiment::TEST_ONLY_TCMALLOC_POW2_SIZECLASS, "TEST_ONLY_TCMALLOC_POW2_SIZECLASS"},
5658
{Experiment::TEST_ONLY_TCMALLOC_PREFERENTIAL_COLLAPSE, "TEST_ONLY_TCMALLOC_PREFERENTIAL_COLLAPSE"},
5759
{Experiment::TEST_ONLY_TCMALLOC_REUSE_SIZE_CLASSES_V2, "TEST_ONLY_TCMALLOC_REUSE_SIZE_CLASSES_V2"},

tcmalloc/internal/system_allocator.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,10 @@ std::pair<void*, size_t> SystemAllocator<Topology>::MmapRegion::Alloc(
365365
// For cold regions (kInfrequentAccess) and sampled regions
366366
// (kInfrequentAllocation), we want as granular of access telemetry as
367367
// possible; this hint means we can get 4kiB granularity instead of 2MiB.
368-
if (hint_ == AddressRegionFactory::UsageHint::kInfrequentAccess ||
369-
hint_ == AddressRegionFactory::UsageHint::kInfrequentAllocation ||
368+
if (((hint_ == AddressRegionFactory::UsageHint::kInfrequentAccess ||
369+
hint_ == AddressRegionFactory::UsageHint::kInfrequentAllocation) &&
370+
!IsExperimentActive(
371+
Experiment::TEST_ONLY_TCMALLOC_MADV_COLD_HUGEPAGE)) ||
370372
system_allocator_internal::preferential_collapse()) {
371373
// This is only advisory, so ignore the error.
372374
ErrnoRestorer errno_restorer;

0 commit comments

Comments
 (0)