Add volatile to some cancel compaction signals to avoid compiler optimizations
The compaction cancel signals are delivered between different threads so add volatile keyword for such variables to make sure the compiler does not try to optimize the values avoiding them to be effective due to potential register caching. Bug: 227060330 Test: Manual Change-Id: I42503e02627c6f76382a58da9320b3f5df15a75d
This commit is contained in:
@@ -1737,7 +1737,7 @@ public final class CachedAppOptimizer {
|
||||
* Default implementation for ProcessDependencies, public vor visibility to OomAdjuster class.
|
||||
*/
|
||||
private static final class DefaultProcessDependencies implements ProcessDependencies {
|
||||
public static int mPidCompacting = -1;
|
||||
public static volatile int mPidCompacting = -1;
|
||||
|
||||
// Get memory RSS from process.
|
||||
@Override
|
||||
|
||||
@@ -79,6 +79,8 @@ using android::base::unique_fd;
|
||||
|
||||
namespace android {
|
||||
|
||||
// Signal happening in separate thread that would bail out compaction
|
||||
// before starting next VMA batch
|
||||
static std::atomic<bool> cancelRunningCompaction;
|
||||
|
||||
// Legacy method for compacting processes, any new code should
|
||||
|
||||
Reference in New Issue
Block a user