From e028f37c4325fbdf2565cd3cb6becaf9b40e4777 Mon Sep 17 00:00:00 2001 From: Vaibhav Gogte Date: Fri, 24 Jan 2025 13:09:39 -0800 Subject: [PATCH] Remove test that checks if HugeCache demand release config is set correctly. We already verify this in get_stats_test. This test manipulates the global state, so remove it as it's redundant. It also removes certain flags that were not used. PiperOrigin-RevId: 719409237 Change-Id: Ic0aa26d3954dd9a96541413e6300031788dcc94a --- tcmalloc/BUILD | 2 -- tcmalloc/huge_page_aware_allocator_test.cc | 21 +++------------------ 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/tcmalloc/BUILD b/tcmalloc/BUILD index c2fdc06e6..456d90689 100644 --- a/tcmalloc/BUILD +++ b/tcmalloc/BUILD @@ -911,14 +911,12 @@ cc_test( "//tcmalloc/internal:config", "//tcmalloc/internal:logging", "//tcmalloc/internal:page_size", - "//tcmalloc/internal:parameter_accessors", "//tcmalloc/testing:thread_manager", "@com_github_google_benchmark//:benchmark", "@com_google_absl//absl/base", "@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/base:nullability", "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/flags:flag", "@com_google_absl//absl/meta:type_traits", "@com_google_absl//absl/random", "@com_google_absl//absl/random:bit_gen_ref", diff --git a/tcmalloc/huge_page_aware_allocator_test.cc b/tcmalloc/huge_page_aware_allocator_test.cc index b75376730..89ed49ca2 100644 --- a/tcmalloc/huge_page_aware_allocator_test.cc +++ b/tcmalloc/huge_page_aware_allocator_test.cc @@ -39,7 +39,6 @@ #include "absl/base/optimization.h" #include "absl/base/thread_annotations.h" #include "absl/container/flat_hash_map.h" -#include "absl/flags/flag.h" #include "absl/meta/type_traits.h" #include "absl/random/bit_gen_ref.h" #include "absl/random/distributions.h" @@ -56,21 +55,15 @@ #include "tcmalloc/internal/config.h" #include "tcmalloc/internal/logging.h" #include "tcmalloc/internal/page_size.h" -#include "tcmalloc/internal/parameter_accessors.h" #include "tcmalloc/malloc_extension.h" #include "tcmalloc/mock_huge_page_static_forwarder.h" #include "tcmalloc/page_allocator_test_util.h" #include "tcmalloc/pages.h" -#include "tcmalloc/parameters.h" #include "tcmalloc/span.h" #include "tcmalloc/stats.h" #include "tcmalloc/system-alloc.h" #include "tcmalloc/testing/thread_manager.h" -ABSL_FLAG(std::string, tracefile, "", "file to pull trace from"); -ABSL_FLAG(uint64_t, limit, 0, ""); -ABSL_FLAG(bool, always_check_usage, false, "enable expensive memory checks"); - namespace tcmalloc { namespace tcmalloc_internal { namespace { @@ -477,12 +470,6 @@ TEST_P(HugePageAwareAllocatorTest, old_cache_long_interval); } -TEST_P(HugePageAwareAllocatorTest, SettingDemandBasedReleaseFlags) { - // Checks if we can set the demand-based release flags. - Parameters::set_huge_cache_demand_based_release(false); - EXPECT_EQ(Parameters::huge_cache_demand_based_release(), false); -} - TEST_P(HugePageAwareAllocatorTest, ReleasingSmall) { const bool old_subrelease = allocator_->forwarder().hpaa_subrelease(); allocator_->forwarder().set_hpaa_subrelease(/*value=*/true); @@ -1507,8 +1494,6 @@ TEST_F(StatTest, Basic) { absl::BitGen rng; Span* allocs[kNumAllocs]; - const bool always_check_usage = absl::GetFlag(FLAGS_always_check_usage); - PrepTest(); // DO NOT MALLOC ANYTHING BELOW THIS LINE! WE'RE TRYING TO CAREFULLY COUNT // ALLOCATIONS. @@ -1518,7 +1503,7 @@ TEST_F(StatTest, Basic) { Length k = RandomAllocSize(rng); allocs[i] = Alloc(k, kSpanInfo); // stats are expensive, don't always check - if (i % 10 != 0 && !always_check_usage) continue; + if (i % 10 != 0) continue; CheckStats(); } @@ -1538,13 +1523,13 @@ TEST_F(StatTest, Basic) { } // stats are expensive, don't always check - if (i % 10 != 0 && !always_check_usage) continue; + if (i % 10 != 0) continue; CheckStats(); } for (int i = 0; i < kNumAllocs; ++i) { Free(allocs[i], kSpanInfo); - if (i % 10 != 0 && !always_check_usage) continue; + if (i % 10 != 0) continue; CheckStats(); }