Loading services/core/java/com/android/server/am/CachedAppOptimizer.java +3 −2 Original line number Diff line number Diff line Loading @@ -241,7 +241,8 @@ public final class CachedAppOptimizer { private static final int FREEZE_BINDER_TIMEOUT_MS = 100; private static final int FREEZE_DEADLOCK_TIMEOUT_MS = 1000; @VisibleForTesting static final boolean ENABLE_FILE_COMPACT = false; // If enabled, any compaction issued will apply to code mappings and share memory mappings. @VisibleForTesting static final boolean ENABLE_SHARED_AND_CODE_COMPACT = false; // Defaults for phenotype flags. @VisibleForTesting static final boolean DEFAULT_USE_COMPACTION = true; Loading Loading @@ -1686,7 +1687,7 @@ public final class CachedAppOptimizer { } } if (!ENABLE_FILE_COMPACT) { if (!ENABLE_SHARED_AND_CODE_COMPACT) { if (profile == CompactProfile.SOME) { profile = CompactProfile.NONE; } else if (profile == CompactProfile.FULL) { Loading services/core/jni/com_android_server_am_CachedAppOptimizer.cpp +7 −1 Original line number Diff line number Diff line Loading @@ -333,7 +333,10 @@ static int getFilePageAdvice(const Vma& vma) { return -1; } static int getAnonPageAdvice(const Vma& vma) { if (vma.inode == 0 && !vma.is_shared) { bool hasReadFlag = (vma.flags & PROT_READ) > 0; bool hasWriteFlag = (vma.flags & PROT_WRITE) > 0; bool hasExecuteFlag = (vma.flags & PROT_EXEC) > 0; if ((hasReadFlag || hasWriteFlag) && !hasExecuteFlag && !vma.is_shared) { return MADV_PAGEOUT; } return -1; Loading Loading @@ -376,6 +379,9 @@ static int64_t compactProcess(int pid, VmaToAdviseFunc vmaToAdviseFunc) { ++coldVmaIndex; break; case MADV_PAGEOUT: #ifdef DEBUG_COMPACTION ALOGE("Adding to compact vma=%s", vma.name.c_str()); #endif if (pageoutVmaIndex < pageoutVmas.size()) { pageoutVmas[pageoutVmaIndex] = vma; } else { Loading services/tests/mockingservicestests/src/com/android/server/am/CachedAppOptimizerTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -969,7 +969,7 @@ public final class CachedAppOptimizerTest { mCachedAppOptimizerUnderTest.mLastCompactionStats.clear(); if (CachedAppOptimizer.ENABLE_FILE_COMPACT) { if (CachedAppOptimizer.ENABLE_SHARED_AND_CODE_COMPACT) { // We force a some compaction mCachedAppOptimizerUnderTest.compactApp(processRecord, CachedAppOptimizer.CompactProfile.SOME, CachedAppOptimizer.CompactSource.APP, Loading Loading
services/core/java/com/android/server/am/CachedAppOptimizer.java +3 −2 Original line number Diff line number Diff line Loading @@ -241,7 +241,8 @@ public final class CachedAppOptimizer { private static final int FREEZE_BINDER_TIMEOUT_MS = 100; private static final int FREEZE_DEADLOCK_TIMEOUT_MS = 1000; @VisibleForTesting static final boolean ENABLE_FILE_COMPACT = false; // If enabled, any compaction issued will apply to code mappings and share memory mappings. @VisibleForTesting static final boolean ENABLE_SHARED_AND_CODE_COMPACT = false; // Defaults for phenotype flags. @VisibleForTesting static final boolean DEFAULT_USE_COMPACTION = true; Loading Loading @@ -1686,7 +1687,7 @@ public final class CachedAppOptimizer { } } if (!ENABLE_FILE_COMPACT) { if (!ENABLE_SHARED_AND_CODE_COMPACT) { if (profile == CompactProfile.SOME) { profile = CompactProfile.NONE; } else if (profile == CompactProfile.FULL) { Loading
services/core/jni/com_android_server_am_CachedAppOptimizer.cpp +7 −1 Original line number Diff line number Diff line Loading @@ -333,7 +333,10 @@ static int getFilePageAdvice(const Vma& vma) { return -1; } static int getAnonPageAdvice(const Vma& vma) { if (vma.inode == 0 && !vma.is_shared) { bool hasReadFlag = (vma.flags & PROT_READ) > 0; bool hasWriteFlag = (vma.flags & PROT_WRITE) > 0; bool hasExecuteFlag = (vma.flags & PROT_EXEC) > 0; if ((hasReadFlag || hasWriteFlag) && !hasExecuteFlag && !vma.is_shared) { return MADV_PAGEOUT; } return -1; Loading Loading @@ -376,6 +379,9 @@ static int64_t compactProcess(int pid, VmaToAdviseFunc vmaToAdviseFunc) { ++coldVmaIndex; break; case MADV_PAGEOUT: #ifdef DEBUG_COMPACTION ALOGE("Adding to compact vma=%s", vma.name.c_str()); #endif if (pageoutVmaIndex < pageoutVmas.size()) { pageoutVmas[pageoutVmaIndex] = vma; } else { Loading
services/tests/mockingservicestests/src/com/android/server/am/CachedAppOptimizerTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -969,7 +969,7 @@ public final class CachedAppOptimizerTest { mCachedAppOptimizerUnderTest.mLastCompactionStats.clear(); if (CachedAppOptimizer.ENABLE_FILE_COMPACT) { if (CachedAppOptimizer.ENABLE_SHARED_AND_CODE_COMPACT) { // We force a some compaction mCachedAppOptimizerUnderTest.compactApp(processRecord, CachedAppOptimizer.CompactProfile.SOME, CachedAppOptimizer.CompactSource.APP, Loading