forked from rubenslte/android_kernel_samsung_msm8226
freezer: replace msleep with usleep_delay for sleep time of <20mS
usleep_delay() works more accurately for sleep time of <20mS. All tasks can easily be frozen in under 10 ms, switch to using an initial 1 ms sleep followed by exponential backoff until 8 ms. Change-Id: Id932d7dbefe9c59eded33aa87cdb3cb8b581efa2 Signed-off-by: Sravan Kumar Ambapuram <asravan@codeaurora.org>
This commit is contained in:
@@ -35,6 +35,7 @@ static int try_to_freeze_tasks(bool user_only)
|
||||
u64 elapsed_csecs64;
|
||||
unsigned int elapsed_csecs;
|
||||
bool wakeup = false;
|
||||
int sleep_usecs = USEC_PER_MSEC;
|
||||
|
||||
do_gettimeofday(&start);
|
||||
|
||||
@@ -81,9 +82,12 @@ static int try_to_freeze_tasks(bool user_only)
|
||||
|
||||
/*
|
||||
* We need to retry, but first give the freezing tasks some
|
||||
* time to enter the regrigerator.
|
||||
* time to enter the refrigerator. Start with an initial
|
||||
* 1 ms sleep followed by exponential backoff until 8 ms.
|
||||
*/
|
||||
msleep(10);
|
||||
usleep_range(sleep_usecs / 2, sleep_usecs);
|
||||
if (sleep_usecs < 8 * USEC_PER_MSEC)
|
||||
sleep_usecs *= 2;
|
||||
}
|
||||
|
||||
do_gettimeofday(&end);
|
||||
|
||||
Reference in New Issue
Block a user