aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power/swsusp.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/power/swsusp.c')
-rw-r--r--kernel/power/swsusp.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c
index c4016cbbd3e0..f9238faf76e4 100644
--- a/kernel/power/swsusp.c
+++ b/kernel/power/swsusp.c
@@ -175,6 +175,12 @@ void free_all_swap_pages(int swap, struct bitmap_page *bitmap)
175 */ 175 */
176 176
177#define SHRINK_BITE 10000 177#define SHRINK_BITE 10000
178static inline unsigned long __shrink_memory(long tmp)
179{
180 if (tmp > SHRINK_BITE)
181 tmp = SHRINK_BITE;
182 return shrink_all_memory(tmp);
183}
178 184
179int swsusp_shrink_memory(void) 185int swsusp_shrink_memory(void)
180{ 186{
@@ -195,12 +201,12 @@ int swsusp_shrink_memory(void)
195 if (!is_highmem(zone)) 201 if (!is_highmem(zone))
196 tmp -= zone->free_pages; 202 tmp -= zone->free_pages;
197 if (tmp > 0) { 203 if (tmp > 0) {
198 tmp = shrink_all_memory(SHRINK_BITE); 204 tmp = __shrink_memory(tmp);
199 if (!tmp) 205 if (!tmp)
200 return -ENOMEM; 206 return -ENOMEM;
201 pages += tmp; 207 pages += tmp;
202 } else if (size > image_size / PAGE_SIZE) { 208 } else if (size > image_size / PAGE_SIZE) {
203 tmp = shrink_all_memory(SHRINK_BITE); 209 tmp = __shrink_memory(size - (image_size / PAGE_SIZE));
204 pages += tmp; 210 pages += tmp;
205 } 211 }
206 printk("\b%c", p[i++%4]); 212 printk("\b%c", p[i++%4]);