public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: hugang <hugang@soulinfo.com>
To: Pavel Machek <pavel@ucw.cz>,
	linux-kernel@vger.kernel.org, Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Re: software suspend in 2.5.70-mm3.
Date: Sun, 8 Jun 2003 10:27:08 +0800	[thread overview]
Message-ID: <20030608102708.129e1ea9.hugang@soulinfo.com> (raw)
In-Reply-To: <20030603185551.GA3274@zaurus.ucw.cz>

On Tue, 3 Jun 2003 20:55:51 +0200
Pavel Machek <pavel@ucw.cz> wrote:

>  Locating Ben's patch and forward-porting 
>  it would be way better...

I was tried  Ben's patch, It's cool, Very stable in my laptop.

Here is two patch.
  * suspend.c can swap more pages into swap space.
  * vmscan.c  can make swap out faster.

--- linux-2.5.70/kernel/suspend.c.old	Sun Jun  8 11:09:41 2003
+++ linux-2.5.70/kernel/suspend.c	Sun Jun  8 10:54:55 2003
@@ -621,9 +621,17 @@
  */
 static void free_some_memory(void)
 {
+	unsigned int count = 10;
+
 	printk("Freeing memory: ");
-	while (shrink_all_memory(10000))
+	while (count) {
+		unsigned int ret = shrink_all_memory(4 * 1024 * 1024 / PAGE_SIZE);
+		if (ret == 0) {
+			count--;
+			continue;
+		}
 		printk(".");
+	}
 	printk("|\n");
 }
--- linux-2.5.70/mm/vmscan.c.old	Sun Jun  8 11:08:27 2003
+++ linux-2.5.70/mm/vmscan.c	Sun Jun  8 11:02:27 2003
@@ -882,7 +882,8 @@
  * dead and from now on, only perform a short scan.  Basically we're polling
  * the zone for when the problem goes away.
  */
-static int balance_pgdat(pg_data_t *pgdat, int nr_pages, struct page_state *ps)
+static int balance_pgdat(pg_data_t *pgdat, int nr_pages,
+		struct page_state *ps, unsigned int time)
 {
 	int to_free = nr_pages;
 	int priority;
@@ -930,7 +931,7 @@
 		}
 		if (all_zones_ok)
 			break;
-		blk_congestion_wait(WRITE, HZ/10);
+		blk_congestion_wait(WRITE, HZ/time);
 	}
 	return nr_pages - to_free;
 }
@@ -984,7 +985,7 @@
 		schedule();
 		finish_wait(&pgdat->kswapd_wait, &wait);
 		get_page_state(&ps);
-		balance_pgdat(pgdat, 0, &ps);
+		balance_pgdat(pgdat, 0, &ps, 10);
 	}
 }
 
@@ -1020,7 +1021,7 @@
 		struct page_state ps;
 
 		get_page_state(&ps);
-		freed = balance_pgdat(pgdat, nr_to_free, &ps);
+		freed = balance_pgdat(pgdat, nr_to_free, &ps, 200);
 		ret += freed;
 		nr_to_free -= freed;
 		if (nr_to_free <= 0)

-- 
Hu Gang / Steve
Email        : huagng@soulinfo.com, steve@soulinfo.com
GPG FinePrint: 4099 3F1D AE01 1817 68F7  D499 A6C2 C418 86C8 610E
http://soulinfo.com/~hugang/HuGang.asc
ICQ#         : 205800361
Registered Linux User : 204016

      parent reply	other threads:[~2003-06-08  2:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-03 13:11 software suspend in 2.5.70-mm3 hugang
2003-06-03 13:22 ` Alan Cox
2003-06-03 14:35   ` hugang
2003-06-03 14:08     ` Alan Cox
2003-06-03 17:04       ` Benjamin Herrenschmidt
2003-06-04 13:14         ` IDE Power Management (Was: software suspend in 2.5.70-mm3) Benjamin Herrenschmidt
2003-06-04 13:51           ` Michael Frank
2003-06-04 13:58             ` Benjamin Herrenschmidt
2003-06-04 14:10             ` Michael Frank
2003-06-04 14:29               ` Benjamin Herrenschmidt
2003-06-04 14:35                 ` Michael Frank
2003-06-04 19:46                 ` Pavel Machek
2003-06-04 20:16           ` Pavel Machek
2003-06-03 18:55     ` software suspend in 2.5.70-mm3 Pavel Machek
2003-06-08  2:26       ` hugang
2003-06-08 18:29         ` Pavel Machek
2003-06-08  2:27       ` hugang [this message]

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=20030608102708.129e1ea9.hugang@soulinfo.com \
    --to=hugang@soulinfo.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@ucw.cz \
    /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