Make sure gc_urgent is normal mode, when no need GC
Test: 1. Unplug charging
2. Wait an hour
3. Check logcat has "average write volume: 0"
Signed-off-by: Dylan Chang <dylan.chang@nothing.tech>
Change-Id: I5130cc65ed4d96503e960bc0c6aa879fea3d14bc
This commit is contained in:
@@ -2802,6 +2802,8 @@ class StorageManagerService extends IStorageManager.Stub
|
||||
enforcePermission(android.Manifest.permission.MOUNT_FORMAT_FILESYSTEMS);
|
||||
|
||||
try {
|
||||
int avgWriteAmount = 0;
|
||||
int targetDirtyRatio = mTargetDirtyRatio;
|
||||
int latestWrite = mVold.getWriteAmount();
|
||||
if (latestWrite == -1) {
|
||||
Slog.w(TAG, "Failed to get storage write record");
|
||||
@@ -2814,11 +2816,12 @@ class StorageManagerService extends IStorageManager.Stub
|
||||
// (first boot after OTA), We skip the smart idle maintenance
|
||||
if (!needsCheckpoint() || !supportsBlockCheckpoint()) {
|
||||
if (!refreshLifetimeConstraint() || !checkChargeStatus()) {
|
||||
return;
|
||||
Slog.i(TAG, "Turn off gc_urgent based on checking lifetime and charge status");
|
||||
targetDirtyRatio = 100;
|
||||
} else {
|
||||
avgWriteAmount = getAverageWriteAmount();
|
||||
}
|
||||
|
||||
int avgWriteAmount = getAverageWriteAmount();
|
||||
|
||||
Slog.i(TAG, "Set smart idle maintenance: " + "latest write amount: " +
|
||||
latestWrite + ", average write amount: " + avgWriteAmount +
|
||||
", min segment threshold: " + mMinSegmentsThreshold +
|
||||
@@ -2826,10 +2829,10 @@ class StorageManagerService extends IStorageManager.Stub
|
||||
", segment reclaim weight: " + mSegmentReclaimWeight +
|
||||
", period(min): " + sSmartIdleMaintPeriod +
|
||||
", min gc sleep time(ms): " + mMinGCSleepTime +
|
||||
", target dirty ratio: " + mTargetDirtyRatio);
|
||||
", target dirty ratio: " + targetDirtyRatio);
|
||||
mVold.setGCUrgentPace(avgWriteAmount, mMinSegmentsThreshold, mDirtyReclaimRate,
|
||||
mSegmentReclaimWeight, sSmartIdleMaintPeriod,
|
||||
mMinGCSleepTime, mTargetDirtyRatio);
|
||||
mMinGCSleepTime, targetDirtyRatio);
|
||||
} else {
|
||||
Slog.i(TAG, "Skipping smart idle maintenance - block based checkpoint in progress");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user