summaryrefslogtreecommitdiffstats
path: root/kernel/power/process.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-12-08 08:07:16 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-08 08:07:16 -0800
commitdad3de7d0090280f44ff27131ed2878f1ab6ddad (patch)
treef887c721761ce845037d96b59542198294a5d3a5 /kernel/power/process.c
parented9216c1717a3f3738a77908aff78995ea69e7ff (diff)
parent7a1a8eb58a2c6cd819d17332c5a2c369203635d5 (diff)
downloadkernel-crypto-dad3de7d0090280f44ff27131ed2878f1ab6ddad.tar.gz
kernel-crypto-dad3de7d0090280f44ff27131ed2878f1ab6ddad.tar.xz
kernel-crypto-dad3de7d0090280f44ff27131ed2878f1ab6ddad.zip
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6: PM: Add flag for devices capable of generating run-time wake-up events PM / Runtime: Remove unnecessary braces in __pm_runtime_set_status() PM / Runtime: Make documentation of runtime_idle() agree with the code PM / Runtime: Ensure timer_expires is nonzero in pm_schedule_suspend() PM / Runtime: Use deferred_resume flag in pm_request_resume PM / Runtime: Export the PM runtime workqueue PM / Runtime: Fix lockdep warning in __pm_runtime_set_status() PM / Hibernate: Swap, use KERN_CONT PM / Hibernate: Shift remaining code from swsusp.c to hibernate.c PM / Hibernate: Move swap functions to kernel/power/swap.c. PM / freezer: Don't get over-anxious while waiting
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 cc2e55373b6..5ade1bdcf36 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);