aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2007-05-06 17:50:52 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-07 15:12:59 -0400
commit56f99bcb52d64d70078b41cc176dd8b6f5763108 (patch)
tree4383e31e46975ae1c1f6c7833bed0766f762f6d5 /kernel/power
parent9b95e43763cfdfebc1318d27e55712e7b6bfe098 (diff)
swsusp: free more memory
Move the definition of PAGES_FOR_IO to kernel/power/power.h and introduce SPARE_PAGES representing the number of pages that should be freed by the swsusp's memory shrinker in addition to PAGES_FOR_IO so that device drivers can allocate some memory (up to 1 MB total) in their .suspend() routines without causing the suspend to fail. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Pavel Machek <pavel@ucw.cz> Cc: Nigel Cunningham <nigel@nigel.suspend2.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/power')
-rw-r--r--kernel/power/power.h12
-rw-r--r--kernel/power/swsusp.c2
2 files changed, 12 insertions, 2 deletions
diff --git a/kernel/power/power.h b/kernel/power/power.h
index a3e47cbdaf31..34b43542785a 100644
--- a/kernel/power/power.h
+++ b/kernel/power/power.h
@@ -14,8 +14,18 @@ struct swsusp_info {
14 14
15 15
16#ifdef CONFIG_SOFTWARE_SUSPEND 16#ifdef CONFIG_SOFTWARE_SUSPEND
17extern int pm_suspend_disk(void); 17/*
18 * Keep some memory free so that I/O operations can succeed without paging
19 * [Might this be more than 4 MB?]
20 */
21#define PAGES_FOR_IO ((4096 * 1024) >> PAGE_SHIFT)
22/*
23 * Keep 1 MB of memory free so that device drivers can allocate some pages in
24 * their .suspend() routines without breaking the suspend to disk.
25 */
26#define SPARE_PAGES ((1024 * 1024) >> PAGE_SHIFT)
18 27
28extern int pm_suspend_disk(void);
19#else 29#else
20static inline int pm_suspend_disk(void) 30static inline int pm_suspend_disk(void)
21{ 31{
diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c
index 1109023d8358..5da304c8f1f6 100644
--- a/kernel/power/swsusp.c
+++ b/kernel/power/swsusp.c
@@ -233,7 +233,7 @@ int swsusp_shrink_memory(void)
233 long size, highmem_size; 233 long size, highmem_size;
234 234
235 highmem_size = count_highmem_pages(); 235 highmem_size = count_highmem_pages();
236 size = count_data_pages() + PAGES_FOR_IO; 236 size = count_data_pages() + PAGES_FOR_IO + SPARE_PAGES;
237 tmp = size; 237 tmp = size;
238 size += highmem_size; 238 size += highmem_size;
239 for_each_zone (zone) 239 for_each_zone (zone)