diff options
Diffstat (limited to 'kernel/power/process.c')
-rw-r--r-- | kernel/power/process.c | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/kernel/power/process.c b/kernel/power/process.c index 78d92dc6a1ed..3bd0d261818f 100644 --- a/kernel/power/process.c +++ b/kernel/power/process.c | |||
@@ -32,7 +32,7 @@ static inline int freezeable(struct task_struct * p) | |||
32 | } | 32 | } |
33 | 33 | ||
34 | /* Refrigerator is place where frozen processes are stored :-). */ | 34 | /* Refrigerator is place where frozen processes are stored :-). */ |
35 | void refrigerator(unsigned long flag) | 35 | void refrigerator(void) |
36 | { | 36 | { |
37 | /* Hmm, should we be allowed to suspend when there are realtime | 37 | /* Hmm, should we be allowed to suspend when there are realtime |
38 | processes around? */ | 38 | processes around? */ |
@@ -41,14 +41,13 @@ void refrigerator(unsigned long flag) | |||
41 | current->state = TASK_UNINTERRUPTIBLE; | 41 | current->state = TASK_UNINTERRUPTIBLE; |
42 | pr_debug("%s entered refrigerator\n", current->comm); | 42 | pr_debug("%s entered refrigerator\n", current->comm); |
43 | printk("="); | 43 | printk("="); |
44 | current->flags &= ~PF_FREEZE; | ||
45 | 44 | ||
45 | frozen_process(current); | ||
46 | spin_lock_irq(¤t->sighand->siglock); | 46 | spin_lock_irq(¤t->sighand->siglock); |
47 | recalc_sigpending(); /* We sent fake signal, clean it up */ | 47 | recalc_sigpending(); /* We sent fake signal, clean it up */ |
48 | spin_unlock_irq(¤t->sighand->siglock); | 48 | spin_unlock_irq(¤t->sighand->siglock); |
49 | 49 | ||
50 | current->flags |= PF_FROZEN; | 50 | while (frozen(current)) |
51 | while (current->flags & PF_FROZEN) | ||
52 | schedule(); | 51 | schedule(); |
53 | pr_debug("%s left refrigerator\n", current->comm); | 52 | pr_debug("%s left refrigerator\n", current->comm); |
54 | current->state = save; | 53 | current->state = save; |
@@ -57,27 +56,23 @@ void refrigerator(unsigned long flag) | |||
57 | /* 0 = success, else # of processes that we failed to stop */ | 56 | /* 0 = success, else # of processes that we failed to stop */ |
58 | int freeze_processes(void) | 57 | int freeze_processes(void) |
59 | { | 58 | { |
60 | int todo; | 59 | int todo; |
61 | unsigned long start_time; | 60 | unsigned long start_time; |
62 | struct task_struct *g, *p; | 61 | struct task_struct *g, *p; |
63 | 62 | unsigned long flags; | |
63 | |||
64 | printk( "Stopping tasks: " ); | 64 | printk( "Stopping tasks: " ); |
65 | start_time = jiffies; | 65 | start_time = jiffies; |
66 | do { | 66 | do { |
67 | todo = 0; | 67 | todo = 0; |
68 | read_lock(&tasklist_lock); | 68 | read_lock(&tasklist_lock); |
69 | do_each_thread(g, p) { | 69 | do_each_thread(g, p) { |
70 | unsigned long flags; | ||
71 | if (!freezeable(p)) | 70 | if (!freezeable(p)) |
72 | continue; | 71 | continue; |
73 | if ((p->flags & PF_FROZEN) || | 72 | if (frozen(p)) |
74 | (p->state == TASK_TRACED) || | ||
75 | (p->state == TASK_STOPPED)) | ||
76 | continue; | 73 | continue; |
77 | 74 | ||
78 | /* FIXME: smp problem here: we may not access other process' flags | 75 | freeze(p); |
79 | without locking */ | ||
80 | p->flags |= PF_FREEZE; | ||
81 | spin_lock_irqsave(&p->sighand->siglock, flags); | 76 | spin_lock_irqsave(&p->sighand->siglock, flags); |
82 | signal_wake_up(p, 0); | 77 | signal_wake_up(p, 0); |
83 | spin_unlock_irqrestore(&p->sighand->siglock, flags); | 78 | spin_unlock_irqrestore(&p->sighand->siglock, flags); |
@@ -91,7 +86,7 @@ int freeze_processes(void) | |||
91 | return todo; | 86 | return todo; |
92 | } | 87 | } |
93 | } while(todo); | 88 | } while(todo); |
94 | 89 | ||
95 | printk( "|\n" ); | 90 | printk( "|\n" ); |
96 | BUG_ON(in_atomic()); | 91 | BUG_ON(in_atomic()); |
97 | return 0; | 92 | return 0; |
@@ -106,10 +101,7 @@ void thaw_processes(void) | |||
106 | do_each_thread(g, p) { | 101 | do_each_thread(g, p) { |
107 | if (!freezeable(p)) | 102 | if (!freezeable(p)) |
108 | continue; | 103 | continue; |
109 | if (p->flags & PF_FROZEN) { | 104 | if (!thaw_process(p)) |
110 | p->flags &= ~PF_FROZEN; | ||
111 | wake_up_process(p); | ||
112 | } else | ||
113 | printk(KERN_INFO " Strange, %s not stopped\n", p->comm ); | 105 | printk(KERN_INFO " Strange, %s not stopped\n", p->comm ); |
114 | } while_each_thread(g, p); | 106 | } while_each_thread(g, p); |
115 | 107 | ||