public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Patrick Mochel <mochel@osdl.org>
Cc: kernel list <linux-kernel@vger.kernel.org>
Subject: Re: [pm] fix oops after saving image
Date: Sat, 4 Oct 2003 00:33:52 +0200	[thread overview]
Message-ID: <20031003223352.GB344@elf.ucw.cz> (raw)
In-Reply-To: <Pine.LNX.4.44.0310031433530.28816-100000@cherise>

Hi!

> > I do not want to waste 4K, does this look better?
> > 									Pavel
> > 
> > --- tmp/linux/kernel/power/swsusp.c	2003-10-02 22:29:06.000000000 +0200
> > +++ linux/kernel/power/swsusp.c	2003-10-02 22:27:07.000000000 +0200
> > @@ -283,6 +283,9 @@
> >  	unsigned long address;
> >  	struct page *page;
> >  
> > +	if (!buffer)
> > +		return -ENOMEM;
> > +
> >  	printk( "Writing data to swap (%d pages): ", nr_copy_pages );
> >  	for (i=0; i<nr_copy_pages; i++) {
> >  		if (!(i%100))
> 
> Argh! This bit was in the previous patch I applied. Please get it 
> straight, or just keep adding to one patch and resending it (with an 
> itemized list of changes). 

I do not want to do that (other people would have problems
reviewing). I'll try to be more carefull.

One thing would help me: could you reply with "Applied" when you apply
some patch? Just now it seems to be silence==applied and reply==some
problem, but that makes it "interesting" to guess what your tree looks
like.

> > @@ -345,7 +348,7 @@
> >  	printk( "|\n" );
> >  
> >  	MDELAY(1000);
> > -	free_page((unsigned long) buffer);
> > +	/* No need to free anything, system is going down, anyway. */
> >  	return 0;
> >  }
> 
> It's technically still incorrect, since you'd still be leaking memory if
> suspend failed. And, the comment is still in an unfortunate place.  
> Something like this, before the function helps to provide understanding of 
> the entire operation:

At this point, suspend may no longer fail: we have ready-to-run image
in swap, and rollback would happen on next reboot -- corrupting
data. Yep better docs is needed.

How about this one?
								Pavel

--- tmp/linux/kernel/power/swsusp.c	2003-10-04 00:21:55.000000000 +0200
+++ linux/kernel/power/swsusp.c	2003-10-04 00:17:19.000000000 +0200
@@ -274,6 +274,17 @@
 	swap_list_unlock();
 }
 
+/**
+ *    write_suspend_image - Write entire image to disk.
+ *
+ *    After writing suspend signature to the disk, suspend may no
+ *    longer fail: we have ready-to-run image in swap, and rollback
+ *    would happen on next reboot -- corrupting data.
+ *
+ *    Note: The buffer we allocate to use to write the suspend header is
+ *    not freed; its not needed since system is going down anyway
+ *    (plus it causes oops and I'm lazy^H^H^H^Htoo busy).
+ */
 static int write_suspend_image(void)
 {
 	int i;
@@ -345,7 +359,6 @@
 	printk( "|\n" );
 
 	MDELAY(1000);
-	free_page((unsigned long) buffer);
 	return 0;
 }
 

-- 
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]

  reply	other threads:[~2003-10-03 22:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-01 22:37 [pm] fix oops after saving image Pavel Machek
2003-10-02 16:40 ` Patrick Mochel
2003-10-02 20:39   ` Pavel Machek
2003-10-03 21:38     ` Patrick Mochel
2003-10-03 22:33       ` Pavel Machek [this message]
2003-10-04  5:17         ` Stan Bubrouski
2003-10-04  8:02           ` Pavel Machek
2003-10-04  7:50             ` Nigel Cunningham
2003-10-04 16:27               ` Stan Bubrouski
2003-10-04 16:26             ` Stan Bubrouski
2003-10-04 16:39               ` Pavel Machek
2003-10-04 16:53                 ` Stan Bubrouski
2003-10-06 22:30         ` Patrick Mochel

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=20031003223352.GB344@elf.ucw.cz \
    --to=pavel@ucw.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mochel@osdl.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