summaryrefslogtreecommitdiff
path: root/kernel/power/process.c
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2004-04-12 00:57:48 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-04-12 00:57:48 -0700
commitd386fe6e327eb7d7808e5cf69fceaba671621ef8 (patch)
tree51c687209fc53d03ad3a1dc7df0d2175a4ad65be /kernel/power/process.c
parent2c22f5c85acb9bc1bc6cde1167d2836b0b3868e1 (diff)
[PATCH] Swsusp should not wake up stopped processes
From: Pavel Machek <pavel@suse.cz> If you stop process with ^Z, then suspend, process is awakened. Thats a bug. Solution is to simply leave already stopped processes alone. Plus we no longer use TASK_STOPPED for processes in refrigerator. Userland might see us and get confused.
Diffstat (limited to 'kernel/power/process.c')
-rw-r--r--kernel/power/process.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/kernel/power/process.c b/kernel/power/process.c
index 15c1b340c2ed..8225457183ed 100644
--- a/kernel/power/process.c
+++ b/kernel/power/process.c
@@ -30,7 +30,8 @@ static inline int freezeable(struct task_struct * p)
if ((p == current) ||
(p->flags & PF_IOTHREAD) ||
(p->state == TASK_ZOMBIE) ||
- (p->state == TASK_DEAD))
+ (p->state == TASK_DEAD) ||
+ (p->state == TASK_STOPPED))
return 0;
return 1;
}
@@ -38,21 +39,19 @@ static inline int freezeable(struct task_struct * p)
/* Refrigerator is place where frozen processes are stored :-). */
void refrigerator(unsigned long flag)
{
- /* You need correct to work with real-time processes.
- OTOH, this way one process may see (via /proc/) some other
- process in stopped state (and thereby discovered we were
- suspended. We probably do not care.
- */
+ /* Hmm, should we be allowed to suspend when there are realtime
+ processes around? */
long save;
save = current->state;
- current->state = TASK_STOPPED;
+ current->state = TASK_UNINTERRUPTIBLE;
pr_debug("%s entered refrigerator\n", current->comm);
printk("=");
current->flags &= ~PF_FREEZE;
- if (flag)
- flush_signals(current); /* We have signaled a kernel thread, which isn't normal behaviour
- and that may lead to 100%CPU sucking because those threads
- just don't manage signals. */
+
+ spin_lock_irq(&current->sighand->siglock);
+ recalc_sigpending(); /* We sent fake signal, clean it up */
+ spin_unlock_irq(&current->sighand->siglock);
+
current->flags |= PF_FROZEN;
while (current->flags & PF_FROZEN)
schedule();