diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/power/process.c | 26 | ||||
-rw-r--r-- | kernel/sched.c | 3 | ||||
-rw-r--r-- | kernel/signal.c | 5 |
3 files changed, 13 insertions, 21 deletions
diff --git a/kernel/power/process.c b/kernel/power/process.c index 78d92dc6a1ed..0a086640bcfc 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,10 +56,10 @@ 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 | ||
64 | printk( "Stopping tasks: " ); | 63 | printk( "Stopping tasks: " ); |
65 | start_time = jiffies; | 64 | start_time = jiffies; |
66 | do { | 65 | do { |
@@ -70,14 +69,12 @@ int freeze_processes(void) | |||
70 | unsigned long flags; | 69 | 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) || | 73 | (p->state == TASK_TRACED) || |
75 | (p->state == TASK_STOPPED)) | 74 | (p->state == TASK_STOPPED)) |
76 | continue; | 75 | continue; |
77 | 76 | ||
78 | /* FIXME: smp problem here: we may not access other process' flags | 77 | freeze(p); |
79 | without locking */ | ||
80 | p->flags |= PF_FREEZE; | ||
81 | spin_lock_irqsave(&p->sighand->siglock, flags); | 78 | spin_lock_irqsave(&p->sighand->siglock, flags); |
82 | signal_wake_up(p, 0); | 79 | signal_wake_up(p, 0); |
83 | spin_unlock_irqrestore(&p->sighand->siglock, flags); | 80 | spin_unlock_irqrestore(&p->sighand->siglock, flags); |
@@ -91,7 +88,7 @@ int freeze_processes(void) | |||
91 | return todo; | 88 | return todo; |
92 | } | 89 | } |
93 | } while(todo); | 90 | } while(todo); |
94 | 91 | ||
95 | printk( "|\n" ); | 92 | printk( "|\n" ); |
96 | BUG_ON(in_atomic()); | 93 | BUG_ON(in_atomic()); |
97 | return 0; | 94 | return 0; |
@@ -106,10 +103,7 @@ void thaw_processes(void) | |||
106 | do_each_thread(g, p) { | 103 | do_each_thread(g, p) { |
107 | if (!freezeable(p)) | 104 | if (!freezeable(p)) |
108 | continue; | 105 | continue; |
109 | if (p->flags & PF_FROZEN) { | 106 | 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 ); | 107 | printk(KERN_INFO " Strange, %s not stopped\n", p->comm ); |
114 | } while_each_thread(g, p); | 108 | } while_each_thread(g, p); |
115 | 109 | ||
diff --git a/kernel/sched.c b/kernel/sched.c index dee96b22635e..a07cff90d849 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -4335,8 +4335,7 @@ static int migration_thread(void * data) | |||
4335 | struct list_head *head; | 4335 | struct list_head *head; |
4336 | migration_req_t *req; | 4336 | migration_req_t *req; |
4337 | 4337 | ||
4338 | if (current->flags & PF_FREEZE) | 4338 | try_to_freeze(); |
4339 | refrigerator(PF_FREEZE); | ||
4340 | 4339 | ||
4341 | spin_lock_irq(&rq->lock); | 4340 | spin_lock_irq(&rq->lock); |
4342 | 4341 | ||
diff --git a/kernel/signal.c b/kernel/signal.c index d1258729a5f9..ca1186eef938 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -213,7 +213,7 @@ static inline int has_pending_signals(sigset_t *signal, sigset_t *blocked) | |||
213 | fastcall void recalc_sigpending_tsk(struct task_struct *t) | 213 | fastcall void recalc_sigpending_tsk(struct task_struct *t) |
214 | { | 214 | { |
215 | if (t->signal->group_stop_count > 0 || | 215 | if (t->signal->group_stop_count > 0 || |
216 | (t->flags & PF_FREEZE) || | 216 | (freezing(t)) || |
217 | PENDING(&t->pending, &t->blocked) || | 217 | PENDING(&t->pending, &t->blocked) || |
218 | PENDING(&t->signal->shared_pending, &t->blocked)) | 218 | PENDING(&t->signal->shared_pending, &t->blocked)) |
219 | set_tsk_thread_flag(t, TIF_SIGPENDING); | 219 | set_tsk_thread_flag(t, TIF_SIGPENDING); |
@@ -2231,8 +2231,7 @@ sys_rt_sigtimedwait(const sigset_t __user *uthese, | |||
2231 | current->state = TASK_INTERRUPTIBLE; | 2231 | current->state = TASK_INTERRUPTIBLE; |
2232 | timeout = schedule_timeout(timeout); | 2232 | timeout = schedule_timeout(timeout); |
2233 | 2233 | ||
2234 | if (current->flags & PF_FREEZE) | 2234 | try_to_freeze(); |
2235 | refrigerator(PF_FREEZE); | ||
2236 | spin_lock_irq(¤t->sighand->siglock); | 2235 | spin_lock_irq(¤t->sighand->siglock); |
2237 | sig = dequeue_signal(current, &these, &info); | 2236 | sig = dequeue_signal(current, &these, &info); |
2238 | current->blocked = current->real_blocked; | 2237 | current->blocked = current->real_blocked; |