From c3686f7f0b335a20a851d2e2ac03dc8427660fad Mon Sep 17 00:00:00 2001 From: Edgar Arriaga Date: Tue, 19 Jul 2022 19:23:09 +0000 Subject: [PATCH] Fix for compaction vma batch not consuming after first send This wrong condition causes it to only send the first batch in full however, if the batch was not processed in full by process madvise then it would bail out instead of resending at starting failure point. Bug: 237600211 Test: am compact full Change-Id: Ibe8e8ecd7ff97a856e533363f6b7ded318968889 Merged-In: Ibe8e8ecd7ff97a856e533363f6b7ded318968889 (cherry picked from commit 7f464fc7b093caec6480966c6c19151b1d67ae88) --- services/core/jni/com_android_server_am_CachedAppOptimizer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/core/jni/com_android_server_am_CachedAppOptimizer.cpp b/services/core/jni/com_android_server_am_CachedAppOptimizer.cpp index dbc1a00ce2740..af5718f076d60 100644 --- a/services/core/jni/com_android_server_am_CachedAppOptimizer.cpp +++ b/services/core/jni/com_android_server_am_CachedAppOptimizer.cpp @@ -113,7 +113,7 @@ uint64_t consumeBytes(VmaBatch& batch, uint64_t bytesToConsume) { uint64_t bytesConsumed = 0; while (bytesConsumed < bytesToConsume) { - if (CC_UNLIKELY(batch.totalVmas > 0)) { + if (CC_UNLIKELY(batch.totalVmas == 0)) { // No more vmas to consume break; }