mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: torvalds@transmeta.com, kernel list <linux-kernel@vger.kernel.org>
Subject: swsusp: comment updates and warning fixes
Date: Thu, 1 Aug 2002 12:38:39 +0200	[thread overview]
Message-ID: <20020801103838.GA115@elf.ucw.cz> (raw)

Hi!

Better comments and less warnings, please apply
								Pavel

--- clean/kernel/suspend.c	Tue Jul 23 10:40:06 2002
+++ linux-swsusp/kernel/suspend.c	Mon Jul 29 20:30:53 2002
@@ -66,6 +66,7 @@
 #include <linux/swapops.h>
 
 extern void signal_wake_up(struct task_struct *t);
+extern int sys_sync(void);
 
 unsigned char software_suspend_enabled = 0;
 
@@ -815,17 +816,17 @@
 	PRINTK(KERN_WARNING "%sLeaving do_magic_suspend_2...\n", name_suspend);	
 }
 
-/*
- * We try to swap out as much as we can then make a copy of the
- * occupied pages in memory so we can make a copy of kernel state
- * atomically, the I/O needed by saving won't bother us anymore. 
- */
 void do_software_suspend(void)
 {
 	arch_prepare_suspend();
 	if (prepare_suspend_console())
 		printk( "%sCan't allocate a console... proceeding\n", name_suspend);
 	if (!prepare_suspend_processes()) {
+
+		/* At this point, all user processes and "dangerous"
+                   kernel threads are stopped. Free some memory, as we
+                   need half of memory free. */
+
 		free_some_memory();
 		
 		/* No need to invalidate any vfsmnt list -- they will be valid after resume, anyway.
@@ -835,8 +836,19 @@
 		 */
 		PRINTK("Syncing disks before copy\n");
 		do_suspend_sync();
+
+		/* Save state of all device drivers, and stop them. */		   
 		if(drivers_suspend()==0)
-			do_magic(0);			/* This function returns after machine woken up from resume */
+			/* If stopping device drivers worked, we proceed basically into
+			 * suspend_save_image.
+			 *
+			 * do_magic(0) returns after system is resumed.
+			 *
+			 * do_magic() copies all "used" memory to "free" memory, then
+			 * unsuspends all device drivers, and writes memory to disk
+			 * using normal kernel mechanism.
+			 */
+			do_magic(0);
 		PRINTK("Restarting processes...\n");
 		thaw_processes();
 	}
@@ -1004,8 +1016,8 @@
 
 static int bdev_write_page(struct block_device *bdev, long pos, void *buf)
 {
-	struct buffer_head *bh;
 #if 0
+	struct buffer_head *bh;
 	BUG_ON (pos%PAGE_SIZE);
 	bh = __bread(bdev, pos/PAGE_SIZE, PAGE_SIZE);
 	if (!bh || (!bh->b_data)) {

-- 
Worst form of spam? Adding advertisment signatures ala sourceforge.net.
What goes next? Inserting advertisment *into* email?

                 reply	other threads:[~2002-08-01 12:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20020801103838.GA115@elf.ucw.cz \
    --to=pavel@ucw.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /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

all inboxes | Powered by JetHome®