提交 c6f37f12 编写于 作者: R Rafael J. Wysocki

PM/Suspend: Do not shrink memory before suspend

Remove the shrinking of memory from the suspend-to-RAM code, where
it is not really necessary.
Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
Acked-by: NNigel Cunningham <nigel@tuxonice.net>
Acked-by: NWu Fengguang <fengguang.wu@intel.com>
上级 e240b58c
...@@ -188,9 +188,6 @@ static void suspend_test_finish(const char *label) ...@@ -188,9 +188,6 @@ static void suspend_test_finish(const char *label)
#endif #endif
/* This is just an arbitrary number */
#define FREE_PAGE_NUMBER (100)
static struct platform_suspend_ops *suspend_ops; static struct platform_suspend_ops *suspend_ops;
/** /**
...@@ -226,7 +223,6 @@ int suspend_valid_only_mem(suspend_state_t state) ...@@ -226,7 +223,6 @@ int suspend_valid_only_mem(suspend_state_t state)
static int suspend_prepare(void) static int suspend_prepare(void)
{ {
int error; int error;
unsigned int free_pages;
if (!suspend_ops || !suspend_ops->enter) if (!suspend_ops || !suspend_ops->enter)
return -EPERM; return -EPERM;
...@@ -241,24 +237,10 @@ static int suspend_prepare(void) ...@@ -241,24 +237,10 @@ static int suspend_prepare(void)
if (error) if (error)
goto Finish; goto Finish;
if (suspend_freeze_processes()) { error = suspend_freeze_processes();
error = -EAGAIN;
goto Thaw;
}
free_pages = global_page_state(NR_FREE_PAGES);
if (free_pages < FREE_PAGE_NUMBER) {
pr_debug("PM: free some memory\n");
shrink_all_memory(FREE_PAGE_NUMBER - free_pages);
if (nr_free_pages() < FREE_PAGE_NUMBER) {
error = -ENOMEM;
printk(KERN_ERR "PM: No enough memory\n");
}
}
if (!error) if (!error)
return 0; return 0;
Thaw:
suspend_thaw_processes(); suspend_thaw_processes();
usermodehelper_enable(); usermodehelper_enable();
Finish: Finish:
......
...@@ -2056,7 +2056,7 @@ unsigned long global_lru_pages(void) ...@@ -2056,7 +2056,7 @@ unsigned long global_lru_pages(void)
+ global_page_state(NR_INACTIVE_FILE); + global_page_state(NR_INACTIVE_FILE);
} }
#ifdef CONFIG_PM #ifdef CONFIG_HIBERNATION
/* /*
* Helper function for shrink_all_memory(). Tries to reclaim 'nr_pages' pages * Helper function for shrink_all_memory(). Tries to reclaim 'nr_pages' pages
* from LRU lists system-wide, for given pass and priority. * from LRU lists system-wide, for given pass and priority.
...@@ -2196,7 +2196,7 @@ unsigned long shrink_all_memory(unsigned long nr_pages) ...@@ -2196,7 +2196,7 @@ unsigned long shrink_all_memory(unsigned long nr_pages)
return sc.nr_reclaimed; return sc.nr_reclaimed;
} }
#endif #endif /* CONFIG_HIBERNATION */
/* It's optimal to keep kswapds on the same CPUs as their memory, but /* It's optimal to keep kswapds on the same CPUs as their memory, but
not required for correctness. So if the last cpu in a node goes not required for correctness. So if the last cpu in a node goes
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册