diff options
Diffstat (limited to 'kernel/power/process.c')
-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); |