Re: [PATCH] PM / Hibernation: Fix *massive* memory leak at earlyexits in hibernation
From: Pavel Machek
Date: Tue Nov 22 2011 - 06:45:51 EST
On Mon 2011-11-21 23:25:39, Rafael J. Wysocki wrote:
> On Monday, November 21, 2011, Srivatsa S. Bhat wrote:
> > 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.
>
> While the observation is valid, I'd prefer to do something like the patch
> below.
The code slowly becomes goto maze :-(.
> @@ -357,12 +357,14 @@ int hibernation_snapshot(int platform_mo
> * successful freezer test.
> */
> freezer_test_done = true;
> - goto Close;
> + goto Cleanup;
> }
>
> error = dpm_prepare(PMSG_FREEZE);
> - if (error)
> - goto Complete_devices;
> + if (error) {
> + dpm_complete(msg);
> + goto Cleanup;
> + }
Perhaps dpm_prepare should be changed to clean after itself in the
error case? That is the normal convention AFAICT....
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/