mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
f2fs: fix unnecessary periodic wakeup of discard thread when dev is busy
When dev is busy, discard thread wake up timeout can be aligned with the exact time that it needs to wait for dev to come out of busy. This helps to avoid unnecessary periodic wakeups and thus save some power. Change-Id: Ic0d113e377062146899cf14cac9c8e7a145f8484 Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
This commit is contained in:
parent
39fe1cda39
commit
8145e4913c
@ -1384,6 +1384,8 @@ static int issue_discard_thread(void *data)
|
||||
struct discard_policy dpolicy;
|
||||
unsigned int wait_ms = DEF_MIN_DISCARD_ISSUE_TIME;
|
||||
int issued;
|
||||
unsigned long interval = sbi->interval_time[REQ_TIME] * HZ;
|
||||
long delta;
|
||||
|
||||
set_freezable();
|
||||
|
||||
@ -1415,7 +1417,11 @@ static int issue_discard_thread(void *data)
|
||||
__wait_all_discard_cmd(sbi, &dpolicy);
|
||||
wait_ms = dpolicy.min_interval;
|
||||
} else if (issued == -1){
|
||||
wait_ms = dpolicy.mid_interval;
|
||||
delta = (sbi->last_time[REQ_TIME] + interval) - jiffies;
|
||||
if (delta > 0)
|
||||
wait_ms = jiffies_to_msecs(delta);
|
||||
else
|
||||
wait_ms = dpolicy.mid_interval;
|
||||
} else {
|
||||
wait_ms = dpolicy.max_interval;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user