linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] swapout speedup 2.1.91-pre2
@ 1998-03-26 11:22 Rik van Riel
  1998-03-26 17:39 ` Linus Torvalds
  0 siblings, 1 reply; 3+ messages in thread
From: Rik van Riel @ 1998-03-26 11:22 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-mm

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);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] swapout speedup 2.1.91-pre2
  1998-03-26 11:22 [PATCH] swapout speedup 2.1.91-pre2 Rik van Riel
@ 1998-03-26 17:39 ` Linus Torvalds
  1998-03-26 18:54   ` Rik van Riel
  0 siblings, 1 reply; 3+ messages in thread
From: Linus Torvalds @ 1998-03-26 17:39 UTC (permalink / raw)
  To: Rik van Riel; +Cc: linux-mm



On Thu, 26 Mar 1998, Rik van Riel wrote:
> 
> 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 :)

Ok, this looks more like the kind of algorithms I wanted. I alread knew
that the hardcoded "50" was wrong, your heuristic looks sensible (with the
modification you already sent to make it slightly less aggressive). 

Anyway, I'm fairly happy with this kind of setup, I'll make a real 2.1.91
soonish,

		Linus

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] swapout speedup 2.1.91-pre2
  1998-03-26 17:39 ` Linus Torvalds
@ 1998-03-26 18:54   ` Rik van Riel
  0 siblings, 0 replies; 3+ messages in thread
From: Rik van Riel @ 1998-03-26 18:54 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Rik van Riel, linux-mm

On Thu, 26 Mar 1998, Linus Torvalds wrote:

> > 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 :)
> 
> Ok, this looks more like the kind of algorithms I wanted. I alread knew
> that the hardcoded "50" was wrong, your heuristic looks sensible (with the
> modification you already sent to make it slightly less aggressive). 
> 
> Anyway, I'm fairly happy with this kind of setup, I'll make a real 2.1.91
> soonish,

Please, don't make it yet, we need some page cache limitation
algorithm too because my machine (and I suspect other midrange
PCees too) just thrashed itself to death because of this...

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> |
+-------------------------------------------+--------------------------+

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1998-03-26 19:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-03-26 11:22 [PATCH] swapout speedup 2.1.91-pre2 Rik van Riel
1998-03-26 17:39 ` Linus Torvalds
1998-03-26 18:54   ` Rik van Riel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox