From 6d03c07907197cc51073262c47c4574e4d0654b6 Mon Sep 17 00:00:00 2001 From: Vaibhav Gogte Date: Fri, 10 Nov 2023 14:15:55 -0800 Subject: [PATCH] Enable wider slabs experiment. When the experiment is enabled, we use wider 512K slabs and double the capacities of size classes in per-cpu cache. PiperOrigin-RevId: 581366463 Change-Id: I7dd1ee8974f81bc5805825a3c52f8776eca0136e --- tcmalloc/cpu_cache.h | 3 ++- tcmalloc/experiment_config.h | 2 ++ tcmalloc/variants.bzl | 6 ++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/tcmalloc/cpu_cache.h b/tcmalloc/cpu_cache.h index faa415c64..6739eb820 100644 --- a/tcmalloc/cpu_cache.h +++ b/tcmalloc/cpu_cache.h @@ -171,7 +171,8 @@ class StaticForwarder { // increases shift by 1 by itself, so we can not increase it further. // // TODO(b/271598304): Complete this experiment. - return IsExperimentActive(Experiment::TEST_ONLY_TCMALLOC_512K_SLAB) && + return (IsExperimentActive(Experiment::TEST_ONLY_TCMALLOC_512K_SLAB) || + IsExperimentActive(Experiment::TCMALLOC_WIDER_SLABS)) && !numa_topology().numa_aware(); } diff --git a/tcmalloc/experiment_config.h b/tcmalloc/experiment_config.h index 3b6e0071f..6d964b405 100644 --- a/tcmalloc/experiment_config.h +++ b/tcmalloc/experiment_config.h @@ -25,6 +25,7 @@ enum class Experiment : int { TEST_ONLY_TCMALLOC_SHARDED_TRANSFER_CACHE, TEST_ONLY_TCMALLOC_FILLER_CHUNKS_PER_ALLOC, TCMALLOC_SHORT_LONG_TERM_SUBRELEASE, + TCMALLOC_WIDER_SLABS, TEST_ONLY_TCMALLOC_512K_SLAB, TEST_ONLY_TCMALLOC_USE_ALL_BUCKETS_FOR_FEW_OBJECT_SPANS_IN_CFL, TEST_ONLY_TCMALLOC_USE_EXTENDED_SIZE_CLASS_FOR_COLD, @@ -42,6 +43,7 @@ inline constexpr ExperimentConfig experiments[] = { {Experiment::TEST_ONLY_TCMALLOC_SHARDED_TRANSFER_CACHE, "TEST_ONLY_TCMALLOC_SHARDED_TRANSFER_CACHE"}, {Experiment::TEST_ONLY_TCMALLOC_FILLER_CHUNKS_PER_ALLOC, "TEST_ONLY_TCMALLOC_FILLER_CHUNKS_PER_ALLOC"}, {Experiment::TCMALLOC_SHORT_LONG_TERM_SUBRELEASE, "TCMALLOC_SHORT_LONG_TERM_SUBRELEASE"}, + {Experiment::TCMALLOC_WIDER_SLABS, "TCMALLOC_WIDER_SLABS"}, {Experiment::TEST_ONLY_TCMALLOC_512K_SLAB, "TEST_ONLY_TCMALLOC_512K_SLAB"}, {Experiment::TEST_ONLY_TCMALLOC_USE_ALL_BUCKETS_FOR_FEW_OBJECT_SPANS_IN_CFL, "TEST_ONLY_TCMALLOC_USE_ALL_BUCKETS_FOR_FEW_OBJECT_SPANS_IN_CFL"}, {Experiment::TEST_ONLY_TCMALLOC_USE_EXTENDED_SIZE_CLASS_FOR_COLD, "TEST_ONLY_TCMALLOC_USE_EXTENDED_SIZE_CLASS_FOR_COLD"}, diff --git a/tcmalloc/variants.bzl b/tcmalloc/variants.bzl index 566d68eb7..7fba4e0a4 100644 --- a/tcmalloc/variants.bzl +++ b/tcmalloc/variants.bzl @@ -120,6 +120,12 @@ test_variants = [ "deps": ["//tcmalloc:common_8k_pages"], "env": {"BORG_EXPERIMENTS": "TEST_ONLY_TCMALLOC_FILLER_CHUNKS_PER_ALLOC"}, }, + { + "name": "wider_slabs", + "malloc": "//tcmalloc", + "deps": ["//tcmalloc:common_8k_pages"], + "env": {"BORG_EXPERIMENTS": "TCMALLOC_WIDER_SLABS"}, + }, { "name": "512k_slab", "malloc": "//tcmalloc",