diff options
-rw-r--r-- | kernel/power/main.c | 20 | ||||
-rw-r--r-- | mm/vmscan.c | 4 |
2 files changed, 3 insertions, 21 deletions
diff --git a/kernel/power/main.c b/kernel/power/main.c index 46386b9f8dd1..2a19f347bd8a 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c | |||
@@ -188,9 +188,6 @@ static void suspend_test_finish(const char *label) | |||
188 | 188 | ||
189 | #endif | 189 | #endif |
190 | 190 | ||
191 | /* This is just an arbitrary number */ | ||
192 | #define FREE_PAGE_NUMBER (100) | ||
193 | |||
194 | static struct platform_suspend_ops *suspend_ops; | 191 | static struct platform_suspend_ops *suspend_ops; |
195 | 192 | ||
196 | /** | 193 | /** |
@@ -226,7 +223,6 @@ int suspend_valid_only_mem(suspend_state_t state) | |||
226 | static int suspend_prepare(void) | 223 | static int suspend_prepare(void) |
227 | { | 224 | { |
228 | int error; | 225 | int error; |
229 | unsigned int free_pages; | ||
230 | 226 | ||
231 | if (!suspend_ops || !suspend_ops->enter) | 227 | if (!suspend_ops || !suspend_ops->enter) |
232 | return -EPERM; | 228 | return -EPERM; |
@@ -241,24 +237,10 @@ static int suspend_prepare(void) | |||
241 | if (error) | 237 | if (error) |
242 | goto Finish; | 238 | goto Finish; |
243 | 239 | ||
244 | if (suspend_freeze_processes()) { | 240 | error = suspend_freeze_processes(); |
245 | error = -EAGAIN; | ||
246 | goto Thaw; | ||
247 | } | ||
248 | |||
249 | free_pages = global_page_state(NR_FREE_PAGES); | ||
250 | if (free_pages < FREE_PAGE_NUMBER) { | ||
251 | pr_debug("PM: free some memory\n"); | ||
252 | shrink_all_memory(FREE_PAGE_NUMBER - free_pages); | ||
253 | if (nr_free_pages() < FREE_PAGE_NUMBER) { | ||
254 | error = -ENOMEM; | ||
255 | printk(KERN_ERR "PM: No enough memory\n"); | ||
256 | } | ||
257 | } | ||
258 | if (!error) | 241 | if (!error) |
259 | return 0; | 242 | return 0; |
260 | 243 | ||
261 | Thaw: | ||
262 | suspend_thaw_processes(); | 244 | suspend_thaw_processes(); |
263 | usermodehelper_enable(); | 245 | usermodehelper_enable(); |
264 | Finish: | 246 | Finish: |
diff --git a/mm/vmscan.c b/mm/vmscan.c index d254306562cd..95c08a8cc2ba 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -2056,7 +2056,7 @@ unsigned long global_lru_pages(void) | |||
2056 | + global_page_state(NR_INACTIVE_FILE); | 2056 | + global_page_state(NR_INACTIVE_FILE); |
2057 | } | 2057 | } |
2058 | 2058 | ||
2059 | #ifdef CONFIG_PM | 2059 | #ifdef CONFIG_HIBERNATION |
2060 | /* | 2060 | /* |
2061 | * Helper function for shrink_all_memory(). Tries to reclaim 'nr_pages' pages | 2061 | * Helper function for shrink_all_memory(). Tries to reclaim 'nr_pages' pages |
2062 | * from LRU lists system-wide, for given pass and priority. | 2062 | * from LRU lists system-wide, for given pass and priority. |
@@ -2196,7 +2196,7 @@ out: | |||
2196 | 2196 | ||
2197 | return sc.nr_reclaimed; | 2197 | return sc.nr_reclaimed; |
2198 | } | 2198 | } |
2199 | #endif | 2199 | #endif /* CONFIG_HIBERNATION */ |
2200 | 2200 | ||
2201 | /* It's optimal to keep kswapds on the same CPUs as their memory, but | 2201 | /* It's optimal to keep kswapds on the same CPUs as their memory, but |
2202 | not required for correctness. So if the last cpu in a node goes | 2202 | not required for correctness. So if the last cpu in a node goes |