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>
Signed-off-by: Panchajanya1999 <kernel@panchajanya.dev>
(cherry picked from commit 72fc44bd8bcfb6d1cbaafb2053173cd985d81d0c)
(cherry picked from commit 7097f6cabd228cf426da77ee71088e56beba3cd0)
(cherry picked from commit 4f1c2d26818d846c0aea6713652e2a0eaa6a23c4)
(cherry picked from commit d416b35f8187c0605ac8816e4d771288514876f1)
This commit is contained in:
Sultan Alsawaf 2023-01-28 13:37:48 +05:30 committed by Ksawlii
parent 3af8699aee
commit a163b49c80

View file

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