[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] stricter pagecache pruning
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/ |
+-------------------------------------------------------------------+
--- 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))