PM / freezer: Reduce freeze timeout to 1 second for Android

Freezing processes on Android usually takes less than 100 ms, and if it
takes longer than that to the point where the 20 second freeze timeout is
reached, it's because the remaining processes to be frozen are deadlocked
waiting for something from a process which is already frozen. There's no
point in burning power trying to freeze for that long, so reduce the freeze
timeout to a very generous 1 second for Android and don't let anything mess
with it.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
fourteen
Sultan Alsawaf 3 years ago committed by Jenna
parent f7ff514106
commit c09e657655
  1. 3
      kernel/power/main.c
  2. 3
      kernel/power/process.c

@ -984,6 +984,9 @@ static ssize_t pm_freeze_timeout_store(struct kobject *kobj,
{
unsigned long val;
if (IS_ENABLED(CONFIG_ANDROID))
return n;
if (kstrtoul(buf, 10, &val))
return -EINVAL;

@ -27,7 +27,8 @@
/*
* Timeout for stopping processes
*/
unsigned int __read_mostly freeze_timeout_msecs = 20 * MSEC_PER_SEC;
unsigned int __read_mostly freeze_timeout_msecs =
IS_ENABLED(CONFIG_ANDROID) ? MSEC_PER_SEC : 20 * MSEC_PER_SEC;
static int try_to_freeze_tasks(bool user_only)
{

Loading…
Cancel
Save