Commit d386fe6e authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[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.
parent 2c22f5c8
...@@ -30,7 +30,8 @@ static inline int freezeable(struct task_struct * p) ...@@ -30,7 +30,8 @@ static inline int freezeable(struct task_struct * p)
if ((p == current) || if ((p == current) ||
(p->flags & PF_IOTHREAD) || (p->flags & PF_IOTHREAD) ||
(p->state == TASK_ZOMBIE) || (p->state == TASK_ZOMBIE) ||
(p->state == TASK_DEAD)) (p->state == TASK_DEAD) ||
(p->state == TASK_STOPPED))
return 0; return 0;
return 1; return 1;
} }
...@@ -38,21 +39,19 @@ static inline int freezeable(struct task_struct * p) ...@@ -38,21 +39,19 @@ static inline int freezeable(struct task_struct * p)
/* Refrigerator is place where frozen processes are stored :-). */ /* Refrigerator is place where frozen processes are stored :-). */
void refrigerator(unsigned long flag) void refrigerator(unsigned long flag)
{ {
/* You need correct to work with real-time processes. /* Hmm, should we be allowed to suspend when there are realtime
OTOH, this way one process may see (via /proc/) some other processes around? */
process in stopped state (and thereby discovered we were
suspended. We probably do not care.
*/
long save; long save;
save = current->state; save = current->state;
current->state = TASK_STOPPED; current->state = TASK_UNINTERRUPTIBLE;
pr_debug("%s entered refrigerator\n", current->comm); pr_debug("%s entered refrigerator\n", current->comm);
printk("="); printk("=");
current->flags &= ~PF_FREEZE; current->flags &= ~PF_FREEZE;
if (flag)
flush_signals(current); /* We have signaled a kernel thread, which isn't normal behaviour spin_lock_irq(&current->sighand->siglock);
and that may lead to 100%CPU sucking because those threads recalc_sigpending(); /* We sent fake signal, clean it up */
just don't manage signals. */ spin_unlock_irq(&current->sighand->siglock);
current->flags |= PF_FROZEN; current->flags |= PF_FROZEN;
while (current->flags & PF_FROZEN) while (current->flags & PF_FROZEN)
schedule(); schedule();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment