提交 e7cd8a72 编写于 作者: R Rafael J. Wysocki 提交者: Linus Torvalds

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: NRafael J. Wysocki <rjw@sisk.pl>
Acked-by: NPavel Machek <pavel@ucw.cz>
Cc: Gautham R Shenoy <ego@in.ibm.com>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 f4a3a7d6
......@@ -105,7 +105,7 @@ static void cancel_freezing(struct task_struct *p)
}
}
static unsigned int try_to_freeze_tasks(int freeze_user_space)
static int try_to_freeze_tasks(int freeze_user_space)
{
struct task_struct *g, *p;
unsigned long end_time;
......@@ -176,28 +176,25 @@ static unsigned int try_to_freeze_tasks(int freeze_user_space)
read_unlock(&tasklist_lock);
}
return todo;
return todo ? -EBUSY : 0;
}
/**
* freeze_processes - tell processes to enter the refrigerator
*
* Returns 0 on success, or the number of processes that didn't freeze,
* although they were told to.
*/
int freeze_processes(void)
{
unsigned int nr_unfrozen;
int error;
printk("Stopping tasks ... ");
nr_unfrozen = try_to_freeze_tasks(FREEZER_USER_SPACE);
if (nr_unfrozen)
return nr_unfrozen;
error = try_to_freeze_tasks(FREEZER_USER_SPACE);
if (error)
return error;
sys_sync();
nr_unfrozen = try_to_freeze_tasks(FREEZER_KERNEL_THREADS);
if (nr_unfrozen)
return nr_unfrozen;
error = try_to_freeze_tasks(FREEZER_KERNEL_THREADS);
if (error)
return error;
printk("done.\n");
BUG_ON(in_atomic());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册