public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>,
	len.brown@intel.com, tj@kernel.org, linux-kernel@vger.kernel.org,
	linux-pm@vger.kernel.org
Subject: Re: [PATCH] PM / Hibernation: Fix *massive* memory leak at early exits in hibernation
Date: Tue, 22 Nov 2011 12:45:49 +0100	[thread overview]
Message-ID: <20111122114549.GC32023@elf.ucw.cz> (raw)
In-Reply-To: <201111212325.39330.rjw@sisk.pl>

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

  reply	other threads:[~2011-11-22 11:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111122114549.GC32023@elf.ucw.cz \
    --to=pavel@ucw.cz \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@sisk.pl \
    --cc=srivatsa.bhat@linux.vnet.ibm.com \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox