diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
commit | ada47b5fe13d89735805b566185f4885f5a3f750 (patch) | |
tree | 644b88f8a71896307d71438e9b3af49126ffb22b /kernel/power/process.c | |
parent | 43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff) | |
parent | 3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff) |
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'kernel/power/process.c')
-rw-r--r-- | kernel/power/process.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/kernel/power/process.c b/kernel/power/process.c index cc2e55373b68..71ae29052ab6 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); |
@@ -82,12 +88,11 @@ static int try_to_freeze_tasks(bool sig_only) | |||
82 | printk(KERN_ERR "Freezing of tasks failed after %d.%02d seconds " | 88 | printk(KERN_ERR "Freezing of tasks failed after %d.%02d seconds " |
83 | "(%d tasks refusing to freeze):\n", | 89 | "(%d tasks refusing to freeze):\n", |
84 | elapsed_csecs / 100, elapsed_csecs % 100, todo); | 90 | elapsed_csecs / 100, elapsed_csecs % 100, todo); |
85 | show_state(); | ||
86 | read_lock(&tasklist_lock); | 91 | read_lock(&tasklist_lock); |
87 | do_each_thread(g, p) { | 92 | do_each_thread(g, p) { |
88 | task_lock(p); | 93 | task_lock(p); |
89 | if (freezing(p) && !freezer_should_skip(p)) | 94 | if (freezing(p) && !freezer_should_skip(p)) |
90 | printk(KERN_ERR " %s\n", p->comm); | 95 | sched_show_task(p); |
91 | cancel_freezing(p); | 96 | cancel_freezing(p); |
92 | task_unlock(p); | 97 | task_unlock(p); |
93 | } while_each_thread(g, p); | 98 | } while_each_thread(g, p); |
@@ -139,7 +144,7 @@ static void thaw_tasks(bool nosig_only) | |||
139 | if (nosig_only && should_send_signal(p)) | 144 | if (nosig_only && should_send_signal(p)) |
140 | continue; | 145 | continue; |
141 | 146 | ||
142 | if (cgroup_frozen(p)) | 147 | if (cgroup_freezing_or_frozen(p)) |
143 | continue; | 148 | continue; |
144 | 149 | ||
145 | thaw_process(p); | 150 | thaw_process(p); |