diff options
Diffstat (limited to 'kernel/power/disk.c')
-rw-r--r-- | kernel/power/disk.c | 30 |
1 files changed, 3 insertions, 27 deletions
diff --git a/kernel/power/disk.c b/kernel/power/disk.c index 76a5131b0e80..9e51cdf7b78d 100644 --- a/kernel/power/disk.c +++ b/kernel/power/disk.c | |||
@@ -24,6 +24,7 @@ | |||
24 | 24 | ||
25 | extern suspend_disk_method_t pm_disk_mode; | 25 | extern suspend_disk_method_t pm_disk_mode; |
26 | 26 | ||
27 | extern int swsusp_shrink_memory(void); | ||
27 | extern int swsusp_suspend(void); | 28 | extern int swsusp_suspend(void); |
28 | extern int swsusp_write(struct pbe *pblist, unsigned int nr_pages); | 29 | extern int swsusp_write(struct pbe *pblist, unsigned int nr_pages); |
29 | extern int swsusp_check(void); | 30 | extern int swsusp_check(void); |
@@ -73,31 +74,6 @@ static void power_down(suspend_disk_method_t mode) | |||
73 | static int in_suspend __nosavedata = 0; | 74 | static int in_suspend __nosavedata = 0; |
74 | 75 | ||
75 | 76 | ||
76 | /** | ||
77 | * free_some_memory - Try to free as much memory as possible | ||
78 | * | ||
79 | * ... but do not OOM-kill anyone | ||
80 | * | ||
81 | * Notice: all userland should be stopped at this point, or | ||
82 | * livelock is possible. | ||
83 | */ | ||
84 | |||
85 | static void free_some_memory(void) | ||
86 | { | ||
87 | unsigned int i = 0; | ||
88 | unsigned int tmp; | ||
89 | unsigned long pages = 0; | ||
90 | char *p = "-\\|/"; | ||
91 | |||
92 | printk("Freeing memory... "); | ||
93 | while ((tmp = shrink_all_memory(10000))) { | ||
94 | pages += tmp; | ||
95 | printk("\b%c", p[i++ % 4]); | ||
96 | } | ||
97 | printk("\bdone (%li pages freed)\n", pages); | ||
98 | } | ||
99 | |||
100 | |||
101 | static inline void platform_finish(void) | 77 | static inline void platform_finish(void) |
102 | { | 78 | { |
103 | if (pm_disk_mode == PM_DISK_PLATFORM) { | 79 | if (pm_disk_mode == PM_DISK_PLATFORM) { |
@@ -127,8 +103,8 @@ static int prepare_processes(void) | |||
127 | } | 103 | } |
128 | 104 | ||
129 | /* Free memory before shutting down devices. */ | 105 | /* Free memory before shutting down devices. */ |
130 | free_some_memory(); | 106 | if (!(error = swsusp_shrink_memory())) |
131 | return 0; | 107 | return 0; |
132 | thaw: | 108 | thaw: |
133 | thaw_processes(); | 109 | thaw_processes(); |
134 | enable_nonboot_cpus(); | 110 | enable_nonboot_cpus(); |