aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Machek <pavel@ucw.cz>2005-09-03 18:57:05 -0400
committerLinus Torvalds <torvalds@evo.osdl.org>2005-09-05 03:06:17 -0400
commit6161b2ce8116b9a623260ab811e2c035b3fac2e5 (patch)
tree8cb36b11631c0843fb5a7e600626a2f6a230846b
parent99dc7d63e0dcb457580241055b2a39d011309db8 (diff)
[PATCH] pm: fix process freezing
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> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--kernel/power/process.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/kernel/power/process.c b/kernel/power/process.c
index f7da5bfc914e..28de118f7a0b 100644
--- a/kernel/power/process.c
+++ b/kernel/power/process.c
@@ -81,13 +81,33 @@ int freeze_processes(void)
81 } while_each_thread(g, p); 81 } while_each_thread(g, p);
82 read_unlock(&tasklist_lock); 82 read_unlock(&tasklist_lock);
83 yield(); /* Yield is okay here */ 83 yield(); /* Yield is okay here */
84 if (time_after(jiffies, start_time + TIMEOUT)) { 84 if (todo && time_after(jiffies, start_time + TIMEOUT)) {
85 printk( "\n" ); 85 printk( "\n" );
86 printk(KERN_ERR " stopping tasks failed (%d tasks remaining)\n", todo ); 86 printk(KERN_ERR " stopping tasks failed (%d tasks remaining)\n", todo );
87 return todo; 87 break;
88 } 88 }
89 } while(todo); 89 } while(todo);
90 90
91 /* This does not unfreeze processes that are already frozen
92 * (we have slightly ugly calling convention in that respect,
93 * and caller must call thaw_processes() if something fails),
94 * but it cleans up leftover PF_FREEZE requests.
95 */
96 if (todo) {
97 read_lock(&tasklist_lock);
98 do_each_thread(g, p)
99 if (freezing(p)) {
100 pr_debug(" clean up: %s\n", p->comm);
101 p->flags &= ~PF_FREEZE;
102 spin_lock_irqsave(&p->sighand->siglock, flags);
103 recalc_sigpending_tsk(p);
104 spin_unlock_irqrestore(&p->sighand->siglock, flags);
105 }
106 while_each_thread(g, p);
107 read_unlock(&tasklist_lock);
108 return todo;
109 }
110
91 printk( "|\n" ); 111 printk( "|\n" );
92 BUG_ON(in_atomic()); 112 BUG_ON(in_atomic());
93 return 0; 113 return 0;