Merge "Make minimum gc sleep time tunnable" am: a5d927ba6a am: fc5cdcf04a am: 861b6f454d

Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2132536

Change-Id: I0441fe849a864bc45c2c07a10480f6ed0841dca4
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:36:34 +00:00 committed by Automerger Merge Worker
commit 2c4fabe16e
5 changed files with 10 additions and 9 deletions

View file

@ -86,7 +86,6 @@ static const int DIRTY_SEGMENTS_THRESHOLD = 100;
static const int GC_TIMEOUT_SEC = 420;
static const int DEVGC_TIMEOUT_SEC = 120;
static const int KBYTES_IN_SEGMENT = 2048;
static const int MIN_GC_URGENT_SLEEP_TIME = 500;
static const int ONE_MINUTE_IN_MS = 60000;
static const int GC_NORMAL_MODE = 0;
static const int GC_URGENT_MID_MODE = 3;
@ -509,7 +508,7 @@ int32_t GetStorageLifeTime() {
}
void SetGCUrgentPace(int32_t neededSegments, int32_t minSegmentThreshold, float dirtyReclaimRate,
float reclaimWeight, int32_t gcPeriod) {
float reclaimWeight, int32_t gcPeriod, int32_t minGCSleepTime) {
std::list<std::string> paths;
bool needGC = true;
int32_t sleepTime;
@ -571,8 +570,8 @@ void SetGCUrgentPace(int32_t neededSegments, int32_t minSegmentThreshold, float
needGC = false;
} else {
sleepTime = gcPeriod * ONE_MINUTE_IN_MS / neededSegments;
if (sleepTime < MIN_GC_URGENT_SLEEP_TIME) {
sleepTime = MIN_GC_URGENT_SLEEP_TIME;
if (sleepTime < minGCSleepTime) {
sleepTime = minGCSleepTime;
}
}
}

View file

@ -27,7 +27,7 @@ int RunIdleMaint(bool needGC, const android::sp<android::os::IVoldTaskListener>&
int AbortIdleMaint(const android::sp<android::os::IVoldTaskListener>& listener);
int32_t GetStorageLifeTime();
void SetGCUrgentPace(int32_t neededSegments, int32_t minSegmentThreshold, float dirtyReclaimRate,
float reclaimWeight, int32_t gcPeriod);
float reclaimWeight, int32_t gcPeriod, int32_t minGCSleepTime);
void RefreshLatestWrite();
int32_t GetWriteAmount();

View file

@ -495,11 +495,12 @@ binder::Status VoldNativeService::getStorageLifeTime(int32_t* _aidl_return) {
binder::Status VoldNativeService::setGCUrgentPace(int32_t neededSegments,
int32_t minSegmentThreshold,
float dirtyReclaimRate, float reclaimWeight,
int32_t gcPeriod) {
int32_t gcPeriod, int32_t minGCSleepTime) {
ENFORCE_SYSTEM_OR_ROOT;
ACQUIRE_LOCK;
SetGCUrgentPace(neededSegments, minSegmentThreshold, dirtyReclaimRate, reclaimWeight, gcPeriod);
SetGCUrgentPace(neededSegments, minSegmentThreshold, dirtyReclaimRate, reclaimWeight, gcPeriod,
minGCSleepTime);
return Ok();
}

View file

@ -90,7 +90,8 @@ class VoldNativeService : public BinderService<VoldNativeService>, public os::Bn
binder::Status abortIdleMaint(const android::sp<android::os::IVoldTaskListener>& listener);
binder::Status getStorageLifeTime(int32_t* _aidl_return);
binder::Status setGCUrgentPace(int32_t neededSegments, int32_t minSegmentThreshold,
float dirtyReclaimRate, float reclaimWeight, int32_t gcPeriod);
float dirtyReclaimRate, float reclaimWeight, int32_t gcPeriod,
int32_t minGCSleepTime);
binder::Status refreshLatestWrite();
binder::Status getWriteAmount(int32_t* _aidl_return);

View file

@ -69,7 +69,7 @@ interface IVold {
int getStorageLifeTime();
void setGCUrgentPace(int neededSegments, int minSegmentThreshold,
float dirtyReclaimRate, float reclaimWeight,
int gcPeriod);
int gcPeriod, int minGCSleepTime);
void refreshLatestWrite();
int getWriteAmount();