summaryrefslogtreecommitdiffstats
path: root/kernel/power/process.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2009-10-08 22:47:30 +0200
committerRafael J. Wysocki <rjw@sisk.pl>2009-10-28 22:53:09 +0100
commitbe404f0212ffa8f67361f8ee460a25d901d88991 (patch)
treef3f30529e574a935c121926267e38b05388e3095 /kernel/power/process.c
parent964fe080d94db82a3268443e9b9ece4c60246414 (diff)
downloadop-kernel-dev-be404f0212ffa8f67361f8ee460a25d901d88991.zip
op-kernel-dev-be404f0212ffa8f67361f8ee460a25d901d88991.tar.gz
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>
Diffstat (limited to 'kernel/power/process.c')
-rw-r--r--kernel/power/process.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/kernel/power/process.c b/kernel/power/process.c
index cc2e553..5ade1bd 100644
--- a/kernel/power/process.c
+++ b/kernel/power/process.c
@@ -14,6 +14,7 @@
#include <linux/module.h>
#include <linux/syscalls.h>
#include <linux/freezer.h>
+#include <linux/delay.h>
/*
* Timeout for stopping processes
@@ -41,7 +42,7 @@ static int try_to_freeze_tasks(bool sig_only)
do_gettimeofday(&start);
end_time = jiffies + TIMEOUT;
- do {
+ while (true) {
todo = 0;
read_lock(&tasklist_lock);
do_each_thread(g, p) {
@@ -62,10 +63,15 @@ static int try_to_freeze_tasks(bool sig_only)
todo++;
} while_each_thread(g, p);
read_unlock(&tasklist_lock);
- yield(); /* Yield is okay here */
- if (time_after(jiffies, end_time))
+ if (!todo || time_after(jiffies, end_time))
break;
- } while (todo);
+
+ /*
+ * We need to retry, but first give the freezing tasks some
+ * time to enter the regrigerator.
+ */
+ msleep(10);
+ }
do_gettimeofday(&end);
elapsed_csecs64 = timeval_to_ns(&end) - timeval_to_ns(&start);
OpenPOWER on IntegriCloud