提交 c61978b3 编写于 作者: P Pavel Machek 提交者: Linus Torvalds

[PATCH] swsusp: fix nr_copy_pages

The following patch moves the recalculation of nr_copy_pages so that the right
number is used in the calculation of the size of memory and swap needed.

It prevents swsusp from attempting to suspend if there is not enough memory
and/or swap (which is unlikely anyway).
Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: NPavel Machek <pavel@suse.cz>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 2e4d5822
......@@ -781,18 +781,18 @@ static int swsusp_alloc(void)
{
int error;
pagedir_nosave = NULL;
nr_copy_pages = calc_nr(nr_copy_pages);
pr_debug("suspend: (pages needed: %d + %d free: %d)\n",
nr_copy_pages, PAGES_FOR_IO, nr_free_pages());
pagedir_nosave = NULL;
if (!enough_free_mem())
return -ENOMEM;
if (!enough_swap())
return -ENOSPC;
nr_copy_pages = calc_nr(nr_copy_pages);
if (!(pagedir_save = alloc_pagedir(nr_copy_pages))) {
printk(KERN_ERR "suspend: Allocating pagedir failed.\n");
return -ENOMEM;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册