summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Lokesh Gidra <lokeshgidra@google.com> 2023-03-16 20:58:46 +0000
committer Lokesh Gidra <lokeshgidra@google.com> 2023-03-17 15:42:07 +0000
commit947b322d2c38dea414e9578d25dcf6f1d3963102 (patch)
tree52a5576ac55f4c733451414a81a4eed2045de9dd
parentf6ab24ad8d246a425e70922d5fd7d331737d188e (diff)
Treat uffd-GC like CC when switching to jank-perceptible state
Bug: 160737021 Test: manual Change-Id: I6d4a3f1285dcb1556cbf6a913b9ae43d840c84e2
-rw-r--r--runtime/gc/heap.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index 607c00c451..1169969c27 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -1542,7 +1542,7 @@ void Heap::ThrowOutOfMemoryError(Thread* self, size_t byte_count, AllocatorType
void Heap::DoPendingCollectorTransition() {
CollectorType desired_collector_type = desired_collector_type_;
- if (collector_type_ == kCollectorTypeCC) {
+ if (collector_type_ == kCollectorTypeCC || collector_type_ == kCollectorTypeCMC) {
// App's allocations (since last GC) more than the threshold then do TransitionGC
// when the app was in background. If not then don't do TransitionGC.
size_t num_bytes_allocated_since_gc = GetBytesAllocated() - num_bytes_alive_after_gc_;
@@ -1562,15 +1562,16 @@ void Heap::DoPendingCollectorTransition() {
} else {
VLOG(gc) << "Homogeneous compaction ignored due to jank perceptible process state";
}
- } else if (desired_collector_type == kCollectorTypeCCBackground) {
+ } else if (desired_collector_type == kCollectorTypeCCBackground ||
+ desired_collector_type == kCollectorTypeCMC) {
DCHECK(gUseReadBarrier);
if (!CareAboutPauseTimes()) {
- // Invoke CC full compaction.
+ // Invoke full compaction.
CollectGarbageInternal(collector::kGcTypeFull,
kGcCauseCollectorTransition,
/*clear_soft_references=*/false, GetCurrentGcNum() + 1);
} else {
- VLOG(gc) << "CC background compaction ignored due to jank perceptible process state";
+ VLOG(gc) << "background compaction ignored due to jank perceptible process state";
}
} else {
CHECK_EQ(desired_collector_type, collector_type_) << "Unsupported collector transition";