]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
swsusp: free more memory
authorRafael J. Wysocki <rjw@sisk.pl>
Sun, 6 May 2007 21:50:52 +0000 (14:50 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Mon, 7 May 2007 19:12:59 +0000 (12:12 -0700)
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>
include/linux/suspend.h
kernel/power/power.h
kernel/power/swsusp.c

index 3aecc96acc76754cd029794f53ebdb4da6bd585f..96868be9c211ce435f258ba363911e5ed777b796 100644 (file)
@@ -52,10 +52,4 @@ struct saved_context;
 void __save_processor_state(struct saved_context *ctxt);
 void __restore_processor_state(struct saved_context *ctxt);
 
-/*
- * XXX: We try to keep some more pages free so that I/O operations succeed
- * without paging. Might this be more?
- */
-#define PAGES_FOR_IO   1024
-
 #endif /* _LINUX_SWSUSP_H */
index a3e47cbdaf31ebc9c3b5b1c2a90c19f2eee4e3bb..34b43542785a3859d8e954858346aeb8d409f367 100644 (file)
@@ -14,8 +14,18 @@ struct swsusp_info {
 
 
 #ifdef CONFIG_SOFTWARE_SUSPEND
-extern int pm_suspend_disk(void);
+/*
+ * Keep some memory free so that I/O operations can succeed without paging
+ * [Might this be more than 4 MB?]
+ */
+#define PAGES_FOR_IO   ((4096 * 1024) >> PAGE_SHIFT)
+/*
+ * Keep 1 MB of memory free so that device drivers can allocate some pages in
+ * their .suspend() routines without breaking the suspend to disk.
+ */
+#define SPARE_PAGES    ((1024 * 1024) >> PAGE_SHIFT)
 
+extern int pm_suspend_disk(void);
 #else
 static inline int pm_suspend_disk(void)
 {
index 1109023d8358001cc8497e7de9edb9da42e8ecf3..5da304c8f1f66473233d68d713a66e2a17c59d54 100644 (file)
@@ -233,7 +233,7 @@ int swsusp_shrink_memory(void)
                long size, highmem_size;
 
                highmem_size = count_highmem_pages();
-               size = count_data_pages() + PAGES_FOR_IO;
+               size = count_data_pages() + PAGES_FOR_IO + SPARE_PAGES;
                tmp = size;
                size += highmem_size;
                for_each_zone (zone)