mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: hugang@soulinfo.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: [hugang@soulinfo.com: [PATH]software suspend for ppc.]
Date: Fri, 7 Jan 2005 10:53:16 +0100	[thread overview]
Message-ID: <20050107095316.GB1300@elf.ucw.cz> (raw)
In-Reply-To: <20050107014023.GA29740@hugang.soulinfo.com>

Hi!

> > > adding a option to freeze/thaw_processes, first freeze all user
> > > processess, from now only kernel processess running, Now we can shrink
> > > more memory than current version, after that freeze all processes.
> > > that's mean if your swap space enough, swsusp will not fail. 
> > 
> > Thanks for the port... ...what is the test case this fixes?
> > 
> > Patch is pretty pretty simple, that's good...
> 
> # free
> ....
> Mem:        256368     198148
> ...
> Swap:       524280     140108
> 
> # ./eatmem 256
> 
> now do swsusp, the current swsusp will fail, with the patch it works.

It worked here:

pavel@amd:~/misc$ gcc eatmem.c -o eatmem
eatmem.c: In function `do_malloc':
eatmem.c:10: warning: assignment makes pointer from integer without a
cast
pavel@amd:~/misc$ cat /proc/swaps
Filename                                Type            Size    Used
Priority
/dev/hda1                               partition       1953464 0
-2
pavel@amd:~/misc$ free
             total       used       free     shared    buffers
cached
Mem:       1031568     989672      41896          0      34340
788156
-/+ buffers/cache:     167176     864392
Swap:      1953464          0    1953464
pavel@amd:~/misc$ ./eatmem 1024
1023

(When it was printing around 900, I switched to another console and
tried swsusp (worked ok), then tried again when it printed 1023).

I'm using patched kernel, however, and this patch might be
relevant. Can you try to apply it and see if problem goes away? [This
patch is ugly hack, but if it helps, we'll simply ask akpm to fix
free_some_memory :-)].

								Pavel

--- clean/kernel/power/disk.c	2004-12-25 13:35:03.000000000 +0100
+++ linux/kernel/power/disk.c	2004-12-25 13:05:45.000000000 +0100
@@ -86,23 +86,25 @@
 
 static void free_some_memory(void)
 {
-	unsigned int i = 0;
-	unsigned int tmp;
-	unsigned long pages = 0;
-	char *p = "-\\|/";
-
-	printk("Freeing memory...  ");
-	while ((tmp = shrink_all_memory(10000))) {
-		pages += tmp;
-		printk("\b%c", p[i]);
-		i++;
-		if (i > 3)
-			i = 0;
+	int i;
+	for (i=0; i<5; i++) {
+		int i = 0, tmp;
+		long pages = 0;
+		char *p = "-\\|/";
+
+		printk("Freeing memory...  ");
+		while ((tmp = shrink_all_memory(10000))) {
+			pages += tmp;
+			printk("\b%c", p[i]);
+			i++;
+			if (i > 3)
+				i = 0;
+		}
+		printk("\bdone (%li pages freed)\n", pages);
+		msleep_interruptible(200);
 	}
-	printk("\bdone (%li pages freed)\n", pages);
 }
 
-
 static inline void platform_finish(void)
 {
 	if (pm_disk_mode == PM_DISK_PLATFORM) {
 

-- 
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!

  reply	other threads:[~2005-01-07  9:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-03 12:26 hugang
2005-01-03 22:17 ` Pavel Machek
2005-01-06 16:03   ` hugang
2005-01-06 22:31     ` Pavel Machek
2005-01-06 22:52       ` Nigel Cunningham
2005-01-07  1:40       ` hugang
2005-01-07  9:53         ` Pavel Machek [this message]
     [not found]           ` <20050107131231.GA5345@hugang.soulinfo.com>
2005-01-07 13:25             ` Pavel Machek
2005-01-04  2:34 ` Nigel Cunningham

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=20050107095316.GB1300@elf.ucw.cz \
    --to=pavel@ucw.cz \
    --cc=hugang@soulinfo.com \
    --cc=linux-kernel@vger.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

all inboxes | Powered by JetHome®