linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] stricter pagecache pruning
@ 1998-07-11  7:31 Rik van Riel
  1998-07-11 15:11 ` Andrea Arcangeli
  1998-07-15 16:56 ` Dr. Werner Fink
  0 siblings, 2 replies; 3+ messages in thread
From: Rik van Riel @ 1998-07-11  7:31 UTC (permalink / raw)
  To: Linux MM; +Cc: Andrea Arcangeli

[-- Attachment #1: Type: TEXT/PLAIN, Size: 720 bytes --]

Hi,

I hope this patch will alleviate some of Andrea's
problems with the page cache growing out of bounds.

It makes sure that, when the cache uses too much,
shrink_mmap() is called continuously; only the
last thing tried can be something else.

I'd like to hear some results, as I haven't tried
it myself ... It seems obvious enough, so it would
probably be best if it's tried ASAP with as many
different machines/loads as possible.

Rik.
+-------------------------------------------------------------------+
| Linux memory management tour guide.        H.H.vanRiel@phys.uu.nl |
| Scouting Vries cubscout leader.      http://www.phys.uu.nl/~riel/ |
+-------------------------------------------------------------------+

[-- Attachment #2: mmap-prune-2.1.108.patch --]
[-- Type: TEXT/PLAIN, Size: 938 bytes --]

--- linux/mm/vmscan.c.orig	Sat Jul 11 09:13:37 1998
+++ linux/mm/vmscan.c	Sat Jul 11 09:26:18 1998
@@ -448,7 +448,7 @@
 {
 	static int state = 0;
 	int i=6;
-	int stop;
+	int stop, shrink = 0;
 
 	/* Always trim SLAB caches when memory gets low. */
 	kmem_cache_reap(gfp_mask);
@@ -458,14 +458,19 @@
 	if (gfp_mask & __GFP_WAIT)
 		stop = 0;
 	if (((buffermem >> PAGE_SHIFT) * 100 > buffer_mem.borrow_percent * num_physpages)
-		   || (page_cache_size * 100 > page_cache.borrow_percent * num_physpages))
+		   || (page_cache_size * 100 > page_cache.borrow_percent * num_physpages)) {
 		state = 0;
+		shrink = i - stop;
+	}
 
 	switch (state) {
 		do {
 		case 0:
-			if (shrink_mmap(i, gfp_mask))
-				return 1;
+			do {
+				if (shrink_mmap(i, gfp_mask))
+					return 1;
+				if (shrink) shrink--;
+			} while (shrink);
 			state = 1;
 		case 1:
 			if ((gfp_mask & __GFP_IO) && shm_swap(i, gfp_mask))

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

end of thread, other threads:[~1998-07-15 16:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-07-11  7:31 [PATCH] stricter pagecache pruning Rik van Riel
1998-07-11 15:11 ` Andrea Arcangeli
1998-07-15 16:56 ` Dr. Werner Fink

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