* [patch] Fix process freezing
@ 2005-08-26 9:39 Pavel Machek
0 siblings, 0 replies; only message in thread
From: Pavel Machek @ 2005-08-26 9:39 UTC (permalink / raw)
To: Andrew Morton, kernel list
If process freezing fails, some processes are frozen, and rest are
left in "were asked to be frozen" state. Thats wrong, we should leave
it in some consistent state.
Signed-off-by: Pavel Machek <pavel@suse.cz>
--- linux-mm/kernel/power/process.c 2005-08-24 20:25:11.000000000 +0200
+++ linux/kernel/power/process.c 2005-08-26 11:30:40.000000000 +0200
@@ -81,13 +81,33 @@
} while_each_thread(g, p);
read_unlock(&tasklist_lock);
yield(); /* Yield is okay here */
- if (time_after(jiffies, start_time + TIMEOUT)) {
+ if (todo && time_after(jiffies, start_time + TIMEOUT)) {
printk( "\n" );
printk(KERN_ERR " stopping tasks failed (%d tasks remaining)\n", todo );
- return todo;
+ break;
}
} while(todo);
+ /* This does not unfreeze processes that are already frozen
+ * (we have slightly ugly calling convention in that respect,
+ * and caller must call thaw_processes() if something fails),
+ * but it cleans up leftover PF_FREEZE requests.
+ */
+ if (todo) {
+ read_lock(&tasklist_lock);
+ do_each_thread(g, p)
+ if (freezing(p)) {
+ pr_debug(" clean up: %s\n", p->comm);
+ p->flags &= ~PF_FREEZE;
+ spin_lock_irqsave(&p->sighand->siglock, flags);
+ recalc_sigpending_tsk(p);
+ spin_unlock_irqrestore(&p->sighand->siglock, flags);
+ }
+ while_each_thread(g, p);
+ read_unlock(&tasklist_lock);
+ return todo;
+ }
+
printk( "|\n" );
BUG_ON(in_atomic());
return 0;
--
if you have sharp zaurus hardware you don't need... you know my address
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-08-26 9:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-26 9:39 [patch] Fix process freezing Pavel Machek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox