diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2007-07-19 04:47:34 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-19 13:04:42 -0400 |
commit | e7cd8a722745a01bcfac4d4a52d53391d177da20 (patch) | |
tree | 45c7e57cac39a6aa90d1c5f6682ddd12bdc8315a | |
parent | f4a3a7d60c9c9a961e4c970f6eb41dd1c9d3ec21 (diff) |
Freezer: return int from freeze_processes
Make try_to_freeze_tasks() and freeze_processes() return -EBUSY on failure
instead of the number of unfrozen tasks (none of the callers actually uses
this number).
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Cc: Gautham R Shenoy <ego@in.ibm.com>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | kernel/power/process.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/kernel/power/process.c b/kernel/power/process.c index 9b5301c73b83..00cdbe5f518f 100644 --- a/kernel/power/process.c +++ b/kernel/power/process.c | |||
@@ -105,7 +105,7 @@ static void cancel_freezing(struct task_struct *p) | |||
105 | } | 105 | } |
106 | } | 106 | } |
107 | 107 | ||
108 | static unsigned int try_to_freeze_tasks(int freeze_user_space) | 108 | static int try_to_freeze_tasks(int freeze_user_space) |
109 | { | 109 | { |
110 | struct task_struct *g, *p; | 110 | struct task_struct *g, *p; |
111 | unsigned long end_time; | 111 | unsigned long end_time; |
@@ -176,28 +176,25 @@ static unsigned int try_to_freeze_tasks(int freeze_user_space) | |||
176 | read_unlock(&tasklist_lock); | 176 | read_unlock(&tasklist_lock); |
177 | } | 177 | } |
178 | 178 | ||
179 | return todo; | 179 | return todo ? -EBUSY : 0; |
180 | } | 180 | } |
181 | 181 | ||
182 | /** | 182 | /** |
183 | * freeze_processes - tell processes to enter the refrigerator | 183 | * freeze_processes - tell processes to enter the refrigerator |
184 | * | ||
185 | * Returns 0 on success, or the number of processes that didn't freeze, | ||
186 | * although they were told to. | ||
187 | */ | 184 | */ |
188 | int freeze_processes(void) | 185 | int freeze_processes(void) |
189 | { | 186 | { |
190 | unsigned int nr_unfrozen; | 187 | int error; |
191 | 188 | ||
192 | printk("Stopping tasks ... "); | 189 | printk("Stopping tasks ... "); |
193 | nr_unfrozen = try_to_freeze_tasks(FREEZER_USER_SPACE); | 190 | error = try_to_freeze_tasks(FREEZER_USER_SPACE); |
194 | if (nr_unfrozen) | 191 | if (error) |
195 | return nr_unfrozen; | 192 | return error; |
196 | 193 | ||
197 | sys_sync(); | 194 | sys_sync(); |
198 | nr_unfrozen = try_to_freeze_tasks(FREEZER_KERNEL_THREADS); | 195 | error = try_to_freeze_tasks(FREEZER_KERNEL_THREADS); |
199 | if (nr_unfrozen) | 196 | if (error) |
200 | return nr_unfrozen; | 197 | return error; |
201 | 198 | ||
202 | printk("done.\n"); | 199 | printk("done.\n"); |
203 | BUG_ON(in_atomic()); | 200 | BUG_ON(in_atomic()); |