12 #include <linux/oom.h>
14 #include <linux/module.h>
24 #define TIMEOUT (20 * HZ)
26 static int try_to_freeze_tasks(
bool user_only)
29 unsigned long end_time;
34 unsigned int elapsed_csecs;
42 freeze_workqueues_begin();
62 !freezer_should_skip(p))
68 wq_busy = freeze_workqueues_busy();
88 elapsed_csecs64 = timeval_to_ns(&end) - timeval_to_ns(&start);
90 elapsed_csecs = elapsed_csecs64;
95 "(%d tasks refusing to freeze, wq_busy=%d):\n",
96 wakeup ?
"aborted" :
"failed",
97 elapsed_csecs / 100, elapsed_csecs % 100,
98 todo - wq_busy, wq_busy);
103 if (p !=
current && !freezer_should_skip(p)
104 && freezing(p) && !frozen(p))
110 printk(
"(elapsed %d.%02d seconds) ", elapsed_csecs / 100,
111 elapsed_csecs % 100);
114 return todo ? -
EBUSY : 0;
133 printk(
"Freezing user space processes ... ");
135 error = try_to_freeze_tasks(
true);
139 oom_killer_disable();
161 printk(
"Freezing remaining freezable tasks ... ");
163 error = try_to_freeze_tasks(
false);
186 printk(
"Restarting tasks ... ");
196 usermodehelper_enable();
207 printk(
"Restarting kernel threads ... ");