public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PM / Hibernation: Fix *massive* memory leak at early exits in hibernation
@ 2011-11-21 17:39 Srivatsa S. Bhat
  2011-11-21 22:25 ` Rafael J. Wysocki
  0 siblings, 1 reply; 9+ messages in thread
From: Srivatsa S. Bhat @ 2011-11-21 17:39 UTC (permalink / raw)
  To: rjw; +Cc: pavel, len.brown, tj, linux-kernel, linux-pm

At some of the early exit points during hibernation (exiting either due
to failure or after a successful hibernation test, the memory pre-allocated
for hibernation is not freed up. And this is *very* serious, because, during
pre-allocation, it could have allocated upto a few *gigabytes* of memory!
And hence, if a hibernation fails or even if we run some hibernation tests
using the 'pm_test' framework, the system is rendered unstable due to memory
becoming signifantly lower. Fix this bug.

Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
---

 kernel/power/hibernate.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index 196c0126..dfe07fd 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -346,8 +346,10 @@ int hibernation_snapshot(int platform_mode)
 		goto Close;
 
 	error = freeze_kernel_threads();
-	if (error)
+	if (error) {
+		swsusp_free();
 		goto Close;
+	}
 
 	if (hibernation_test(TEST_FREEZER) ||
 		hibernation_testmode(HIBERNATION_TESTPROC)) {
@@ -357,12 +359,15 @@ int hibernation_snapshot(int platform_mode)
 		 * successful freezer test.
 		 */
 		freezer_test_done = true;
+		swsusp_free();
 		goto Close;
 	}
 
 	error = dpm_prepare(PMSG_FREEZE);
-	if (error)
+	if (error) {
+		swsusp_free();
 		goto Complete_devices;
+	}
 
 	suspend_console();
 	pm_restrict_gfp_mask();


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-11-24 10:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-21 17:39 [PATCH] PM / Hibernation: Fix *massive* memory leak at early exits in hibernation Srivatsa S. Bhat
2011-11-21 22:25 ` Rafael J. Wysocki
2011-11-22 11:45   ` Pavel Machek
2011-11-22 19:05     ` Srivatsa S. Bhat
2011-11-22 20:32       ` Rafael J. Wysocki
2011-11-22 20:45         ` Srivatsa S. Bhat
2011-11-22 20:55           ` Rafael J. Wysocki
2011-11-24 10:37         ` Pavel Machek
2011-11-22 20:33     ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox