diff options
author | Tejun Heo <tj@kernel.org> | 2009-10-08 16:47:30 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2009-10-28 17:53:09 -0400 |
commit | be404f0212ffa8f67361f8ee460a25d901d88991 (patch) | |
tree | f3f30529e574a935c121926267e38b05388e3095 | |
parent | 964fe080d94db82a3268443e9b9ece4c60246414 (diff) |
PM / freezer: Don't get over-anxious while waiting
Freezing isn't exactly the most latency sensitive operation and
there's no reason to burn cpu cycles and power waiting for it to
complete. msleep(10) instead of yield(). This should improve
reliability of emergency hibernation.
[rjw: Modified the comment next to the msleep(10).]
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
-rw-r--r-- | kernel/power/process.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/kernel/power/process.c b/kernel/power/process.c index cc2e55373b68..5ade1bdcf366 100644 --- a/kernel/power/process.c +++ b/kernel/power/process.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/syscalls.h> | 15 | #include <linux/syscalls.h> |
16 | #include <linux/freezer.h> | 16 | #include <linux/freezer.h> |
17 | #include <linux/delay.h> | ||
17 | 18 | ||
18 | /* | 19 | /* |
19 | * Timeout for stopping processes | 20 | * Timeout for stopping processes |
@@ -41,7 +42,7 @@ static int try_to_freeze_tasks(bool sig_only) | |||
41 | do_gettimeofday(&start); | 42 | do_gettimeofday(&start); |
42 | 43 | ||
43 | end_time = jiffies + TIMEOUT; | 44 | end_time = jiffies + TIMEOUT; |
44 | do { | 45 | while (true) { |
45 | todo = 0; | 46 | todo = 0; |
46 | read_lock(&tasklist_lock); | 47 | read_lock(&tasklist_lock); |
47 | do_each_thread(g, p) { | 48 | do_each_thread(g, p) { |
@@ -62,10 +63,15 @@ static int try_to_freeze_tasks(bool sig_only) | |||
62 | todo++; | 63 | todo++; |
63 | } while_each_thread(g, p); | 64 | } while_each_thread(g, p); |
64 | read_unlock(&tasklist_lock); | 65 | read_unlock(&tasklist_lock); |
65 | yield(); /* Yield is okay here */ | 66 | if (!todo || time_after(jiffies, end_time)) |
66 | if (time_after(jiffies, end_time)) | ||
67 | break; | 67 | break; |
68 | } while (todo); | 68 | |
69 | /* | ||
70 | * We need to retry, but first give the freezing tasks some | ||
71 | * time to enter the regrigerator. | ||
72 | */ | ||
73 | msleep(10); | ||
74 | } | ||
69 | 75 | ||
70 | do_gettimeofday(&end); | 76 | do_gettimeofday(&end); |
71 | elapsed_csecs64 = timeval_to_ns(&end) - timeval_to_ns(&start); | 77 | elapsed_csecs64 = timeval_to_ns(&end) - timeval_to_ns(&start); |