Skip to content

Commit

Permalink
Enable wider slabs experiment.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
v-gogte authored and copybara-github committed Nov 10, 2023
1 parent e07f7b3 commit 6d03c07
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tcmalloc/cpu_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
2 changes: 2 additions & 0 deletions tcmalloc/experiment_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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"},
Expand Down
6 changes: 6 additions & 0 deletions tcmalloc/variants.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 6d03c07

Please sign in to comment.