linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Rik van Riel <H.H.vanRiel@fys.ruu.nl>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: linux-mm <linux-mm@kvack.org>
Subject: [PATCH] swapout speedup 2.1.91-pre2
Date: Thu, 26 Mar 1998 12:22:46 +0100 (MET)	[thread overview]
Message-ID: <Pine.LNX.3.91.980326121934.19975A-100000@mirkwood.dummy.home> (raw)

Hi Linus,

here's the speedup patch I promised earlier.
It:
- increases tries when we're tight on memory
- clusters swapouts from user programs (to save disk movement)
- wraps the above in a nice inline

NOTE: this patch is untested, but otherwise completely trivial :)

Rik.
+-------------------------------------------+--------------------------+
| Linux: - LinuxHQ MM-patches page          | Scouting       webmaster |
|        - kswapd ask-him & complain-to guy | Vries    cubscout leader |
|     http://www.fys.ruu.nl/~riel/          | <H.H.vanRiel@fys.ruu.nl> |
+-------------------------------------------+--------------------------+

--- linux/mm/vmscan.c.pre91-2	Thu Mar 26 11:56:00 1998
+++ linux/mm/vmscan.c	Thu Mar 26 12:08:20 1998
@@ -568,7 +568,7 @@
 		 * per second (1.6MB/s). This should be a /proc
 		 * thing.
 		 */
-		tries = 50;
+		tries = (50 << 3) >> free_memory_available(3);
 	
 		while (tries--) {
 			int gfp_mask;
--- linux/mm/page_alloc.c.pre91-2	Thu Mar 26 12:07:00 1998
+++ linux/mm/page_alloc.c	Thu Mar 26 12:07:00 1998
@@ -282,7 +282,7 @@
 	spin_lock_irqsave(&page_alloc_lock, flags);
 	RMQUEUE(order, maxorder, (gfp_mask & GFP_DMA));
 	spin_unlock_irqrestore(&page_alloc_lock, flags);
-	if ((gfp_mask & __GFP_WAIT) && try_to_free_page(gfp_mask))
+	if ((gfp_mask & __GFP_WAIT) && try_to_free_pages(gfp_mask,SWAP_CLUSTER_MAX))
 		goto repeat;
 nopage:
 	return 0;
--- linux/include/linux/swap.h.pre91-2	Thu Mar 26 12:02:14 1998
+++ linux/include/linux/swap.h	Thu Mar 26 12:06:23 1998
@@ -122,6 +122,21 @@
 }
 
 /*
+ * When we're freeing pages from a user application, we want
+ * to cluster swapouts too.	-- Rik.
+ * linux/mm/page_alloc.c
+ */
+static inline int try_to_free_pages(int gfp_mask, int count)
+{
+	int retval = 0;
+	while (count--) {
+		if (try_to_free_page(gfp_mask))
+			retval = 1;
+	}
+	return retval;
+}
+
+/*
  * Make these inline later once they are working properly.
  */
 extern long find_in_swap_cache(struct page *page);

             reply	other threads:[~1998-03-26 13:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-03-26 11:22 Rik van Riel [this message]
1998-03-26 17:39 ` Linus Torvalds
1998-03-26 18:54   ` Rik van Riel

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=Pine.LNX.3.91.980326121934.19975A-100000@mirkwood.dummy.home \
    --to=h.h.vanriel@fys.ruu.nl \
    --cc=linux-mm@kvack.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