Merge changes from topic "gc_sleep_time" am: 4ed3251512

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2133943

Change-Id: I499bc36c2e0e338f0d8ae8923720493fd045d78b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Daeho Jeong
2022-07-07 19:01:06 +00:00
committed by Automerger Merge Worker

View File

@@ -360,6 +360,8 @@ class StorageManagerService extends IStorageManager.Stub
private static final float DEFAULT_LOW_BATTERY_LEVEL = 20F; private static final float DEFAULT_LOW_BATTERY_LEVEL = 20F;
// Decide whether charging is required to turn on the feature // Decide whether charging is required to turn on the feature
private static final boolean DEFAULT_CHARGING_REQUIRED = true; private static final boolean DEFAULT_CHARGING_REQUIRED = true;
// Minimum GC interval sleep time in ms
private static final int DEFAULT_MIN_GC_SLEEPTIME = 10000;
private volatile int mLifetimePercentThreshold; private volatile int mLifetimePercentThreshold;
private volatile int mMinSegmentsThreshold; private volatile int mMinSegmentsThreshold;
@@ -367,6 +369,7 @@ class StorageManagerService extends IStorageManager.Stub
private volatile float mSegmentReclaimWeight; private volatile float mSegmentReclaimWeight;
private volatile float mLowBatteryLevel; private volatile float mLowBatteryLevel;
private volatile boolean mChargingRequired; private volatile boolean mChargingRequired;
private volatile int mMinGCSleepTime;
private volatile boolean mNeedGC; private volatile boolean mNeedGC;
private volatile boolean mPassedLifetimeThresh; private volatile boolean mPassedLifetimeThresh;
@@ -2675,6 +2678,8 @@ class StorageManagerService extends IStorageManager.Stub
"low_battery_level", DEFAULT_LOW_BATTERY_LEVEL); "low_battery_level", DEFAULT_LOW_BATTERY_LEVEL);
mChargingRequired = DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_STORAGE_NATIVE_BOOT, mChargingRequired = DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_STORAGE_NATIVE_BOOT,
"charging_required", DEFAULT_CHARGING_REQUIRED); "charging_required", DEFAULT_CHARGING_REQUIRED);
mMinGCSleepTime = DeviceConfig.getInt(DeviceConfig.NAMESPACE_STORAGE_NATIVE_BOOT,
"min_gc_sleeptime", DEFAULT_MIN_GC_SLEEPTIME);
// If we use the smart idle maintenance, we need to turn off GC in the traditional idle // If we use the smart idle maintenance, we need to turn off GC in the traditional idle
// maintenance to avoid the conflict // maintenance to avoid the conflict
@@ -2792,6 +2797,14 @@ class StorageManagerService extends IStorageManager.Stub
enforcePermission(android.Manifest.permission.MOUNT_FORMAT_FILESYSTEMS); enforcePermission(android.Manifest.permission.MOUNT_FORMAT_FILESYSTEMS);
try { try {
int latestWrite = mVold.getWriteAmount();
if (latestWrite == -1) {
Slog.w(TAG, "Failed to get storage write record");
return;
}
updateStorageWriteRecords(latestWrite);
// Block based checkpoint process runs fstrim. So, if checkpoint is in progress // Block based checkpoint process runs fstrim. So, if checkpoint is in progress
// (first boot after OTA), We skip the smart idle maintenance // (first boot after OTA), We skip the smart idle maintenance
if (!needsCheckpoint() || !supportsBlockCheckpoint()) { if (!needsCheckpoint() || !supportsBlockCheckpoint()) {
@@ -2799,13 +2812,6 @@ class StorageManagerService extends IStorageManager.Stub
return; return;
} }
int latestWrite = mVold.getWriteAmount();
if (latestWrite == -1) {
Slog.w(TAG, "Failed to get storage write record");
return;
}
updateStorageWriteRecords(latestWrite);
int avgWriteAmount = getAverageWriteAmount(); int avgWriteAmount = getAverageWriteAmount();
Slog.i(TAG, "Set smart idle maintenance: " + "latest write amount: " + Slog.i(TAG, "Set smart idle maintenance: " + "latest write amount: " +
@@ -2813,9 +2819,11 @@ class StorageManagerService extends IStorageManager.Stub
", min segment threshold: " + mMinSegmentsThreshold + ", min segment threshold: " + mMinSegmentsThreshold +
", dirty reclaim rate: " + mDirtyReclaimRate + ", dirty reclaim rate: " + mDirtyReclaimRate +
", segment reclaim weight: " + mSegmentReclaimWeight + ", segment reclaim weight: " + mSegmentReclaimWeight +
", period: " + sSmartIdleMaintPeriod); ", period(min): " + sSmartIdleMaintPeriod +
", min gc sleep time(ms): " + mMinGCSleepTime);
mVold.setGCUrgentPace(avgWriteAmount, mMinSegmentsThreshold, mDirtyReclaimRate, mVold.setGCUrgentPace(avgWriteAmount, mMinSegmentsThreshold, mDirtyReclaimRate,
mSegmentReclaimWeight, sSmartIdleMaintPeriod); mSegmentReclaimWeight, sSmartIdleMaintPeriod,
mMinGCSleepTime);
} else { } else {
Slog.i(TAG, "Skipping smart idle maintenance - block based checkpoint in progress"); Slog.i(TAG, "Skipping smart idle maintenance - block based checkpoint in progress");
} }