linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Roger Larsson <roger.larsson@norran.net>
To: "linux-mm@kvack.org" <linux-mm@kvack.org>
Subject: [PATCH] code clean up of kswapd
Date: Tue, 06 Jun 2000 01:13:57 +0200	[thread overview]
Message-ID: <393C3435.8AED5654@norran.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 353 bytes --]

Hi all,

This is only a code clean up of kswapd -
It should do almost the same.

I do not claim improved performance :-(
But improved readability :-)

Basically done to be able to add other
stuff more easily later...

[Not tried against ac8, but ac7+riel.3
 should be almost the same]

Comments?

/RogerL

--
Home page:
  http://www.norran.net/nra02596/

[-- Attachment #2: patch-2.4.0-test1-ac7-riel.3-kswapd.1 --]
[-- Type: text/plain, Size: 1105 bytes --]

--- vmscan.c.riel	Sat Jun  3 19:09:16 2000
+++ vmscan.c	Sat Jun  3 22:30:22 2000
@@ -551,24 +551,39 @@
 	for (;;) {
 		pg_data_t *pgdat;
 		int something_to_do = 0;
+		int more_to_do = 0;
 
 		pgdat = pgdat_list;
 		do {
 			int i;
+
 			for(i = 0; i < MAX_NR_ZONES; i++) {
 				zone_t *zone = pgdat->node_zones+ i;
-				if (tsk->need_resched)
-					schedule();
 				if (!zone->size || !zone->zone_wake_kswapd)
 					continue;
+				something_to_do = 1;
 				if (zone->free_pages < zone->pages_low)
-					something_to_do = 1;
-				do_try_to_free_pages(GFP_KSWAPD);
+				        more_to_do = 1;
 			}
 			pgdat = pgdat->node_next;
+
 		} while (pgdat);
 
-		if (!something_to_do) {
+		/* Need to free pages?
+		 * Will actually run fewer times than previous version!
+		 * (It did run once per zone with waken kswapd)
+		 */
+		if (something_to_do) { 
+		  do_try_to_free_pages(GFP_KSWAPD);
+		}
+
+		/* In a hurry? */
+		if (more_to_do) {
+		        if (tsk->need_resched) {
+		           schedule();
+			}
+		}
+		else {
 			tsk->state = TASK_INTERRUPTIBLE;
 			interruptible_sleep_on(&kswapd_wait);
 		}

                 reply	other threads:[~2000-06-05 23:15 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=393C3435.8AED5654@norran.net \
    --to=roger.larsson@norran.net \
    --cc=linux-mm@kvack.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