summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2025-01-13 15:01:33 +0000
committer Nicolas Geoffray <ngeoffray@google.com> 2025-01-14 04:22:27 -0800
commit93a24263dd2a844c412d07b02756b6e6f39167bf (patch)
treeed9cbe71de1c22d4a56eb3c7be76a0620856f195
parent98430ec86f5ab0aa96269d1f4c19aeee7a373641 (diff)
Enable lazy release on CC for some targets.
Enable it on host and devices that have a kernel > 6.0. This helps performance investigations, as memory management dominates less. Test: test.py Bug: 368455157 Change-Id: I8dd7aa970568e12110d00711bd6db6586cfb2127
-rw-r--r--runtime/gc/collector/garbage_collector.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/runtime/gc/collector/garbage_collector.cc b/runtime/gc/collector/garbage_collector.cc
index 798300fa29..f8eef84f25 100644
--- a/runtime/gc/collector/garbage_collector.cc
+++ b/runtime/gc/collector/garbage_collector.cc
@@ -444,10 +444,10 @@ const Iteration* GarbageCollector::GetCurrentIteration() const {
bool GarbageCollector::ShouldEagerlyReleaseMemoryToOS() const {
// We have seen old kernels and custom kernel features misbehave in the
- // presence of too much usage of MADV_FREE. So always release memory eagerly
- // while we investigate.
- static constexpr bool kEnableLazyRelease = false;
- if (!kEnableLazyRelease) {
+ // presence of too much usage of MADV_FREE. So only release memory eagerly
+ // on platforms we know do not have the bug.
+ static const bool gEnableLazyRelease = !kIsTargetBuild || IsKernelVersionAtLeast(6, 0);
+ if (!gEnableLazyRelease) {
return true;
}
Runtime* runtime = Runtime::Current();