1 From 3f8e407c418205252f00615da4d0182e8c960344 Mon Sep 17 00:00:00 2001
2 From: =?utf-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= <arve@android.com>
3 Date: Tue, 14 Oct 2008 16:02:39 -0700
4 Subject: [PATCH 070/134] PM: wakelock: Abort task freezing if a wake lock is held.
6 Avoids a problem where the device sometimes hangs for 20 seconds
7 before the screen is turned on.
9 kernel/power/process.c | 23 ++++++++++++++++++-----
10 1 files changed, 18 insertions(+), 5 deletions(-)
12 --- a/kernel/power/process.c
13 +++ b/kernel/power/process.c
15 #include <linux/module.h>
16 #include <linux/syscalls.h>
17 #include <linux/freezer.h>
18 +#include <linux/wakelock.h>
21 * Timeout for stopping processes
22 @@ -36,6 +37,7 @@ static int try_to_freeze_tasks(bool sig_
23 struct timeval start, end;
25 unsigned int elapsed_csecs;
26 + unsigned int wakeup = 0;
28 do_gettimeofday(&start);
30 @@ -62,6 +64,10 @@ static int try_to_freeze_tasks(bool sig_
31 } while_each_thread(g, p);
32 read_unlock(&tasklist_lock);
33 yield(); /* Yield is okay here */
34 + if (todo && has_wake_lock(WAKE_LOCK_SUSPEND)) {
38 if (time_after(jiffies, end_time))
41 @@ -77,11 +83,18 @@ static int try_to_freeze_tasks(bool sig_
42 * and caller must call thaw_processes() if something fails),
43 * but it cleans up leftover PF_FREEZE requests.
46 - printk(KERN_ERR "Freezing of tasks failed after %d.%02d seconds "
47 - "(%d tasks refusing to freeze):\n",
48 - elapsed_csecs / 100, elapsed_csecs % 100, todo);
52 + printk(KERN_ERR "Freezing of %s aborted\n",
53 + sig_only ? "user space " : "tasks ");
57 + printk(KERN_ERR "Freezing of tasks failed after %d.%02d seconds "
58 + "(%d tasks refusing to freeze):\n",
59 + elapsed_csecs / 100, elapsed_csecs % 100, todo);
62 read_lock(&tasklist_lock);
63 do_each_thread(g, p) {