* [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
* Re: [PATCH] stricter pagecache pruning
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
1 sibling, 0 replies; 3+ messages in thread
From: Andrea Arcangeli @ 1998-07-11 15:11 UTC (permalink / raw)
To: Rik van Riel; +Cc: Linux MM
On Sat, 11 Jul 1998, Rik van Riel wrote:
>Hi,
>
>I hope this patch will alleviate some of Andrea's
>problems with the page cache growing out of bounds.
Yes it seems really to help. Anyway I think that we could do something of
more clever. Now it happens more rarely that kswapd has to swapout things.
But when this happen the machine stall as usual.
For example if I run `free` a lot of times while cp file /dev/zero is
running, `free` stall only when free' s output will show that the swap is
been increased of a bit (and that some kbyte really don' t help in
function of increased free memory, they only cause a stall sometimes).
The patch helps though, thanks. No other problems so far.
Andrea[s] Arcangeli
--
This is a majordomo managed list. To unsubscribe, send a message with
the body 'unsubscribe linux-mm me@address' to: majordomo@kvack.org
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] stricter pagecache pruning
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
1 sibling, 0 replies; 3+ messages in thread
From: Dr. Werner Fink @ 1998-07-15 16:56 UTC (permalink / raw)
To: Linux MM
On Sat, Jul 11, 1998 at 09:31:26AM +0200, Rik van Riel wrote:
> 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.
Your patch has one side effect ... it reduces the scans of the
other possibilies, to be more precisely, the scanning of the dcache
should also be forced.
A few weeks ago I've send a simple patch which may reduce
the problem. The part in there was:
--------------------------------------------------------
diff -urN linux-2.1.103/mm/vmscan.c linux/mm/vmscan.c
--- linux-2.1.103/mm/vmscan.c Sun May 3 02:44:59 1998
+++ linux/mm/vmscan.c Mon Jun 8 15:46:11 1998
@@ -28,6 +28,9 @@
#include <asm/bitops.h>
#include <asm/pgtable.h>
+extern int inodes_stat[];
+extern int dentry_stat[];
+
/*
* When are we next due for a page scan?
*/
@@ -446,11 +449,13 @@
/* We try harder if we are waiting .. */
stop = 3;
- if (gfp_mask & __GFP_WAIT)
+ if (gfp_mask & __GFP_WAIT || nr_free_pages <= freepages.min);
stop = 0;
if (((buffermem >> PAGE_SHIFT) * 100 > buffer_mem.borrow_percent * num_physpages)
|| (page_cache_size * 100 > page_cache.borrow_percent * num_physpages))
state = 0;
+ else if (dentry_stat[0] > 3*(inodes_stat[0] >> 1))
+ state = 3;
switch (state) {
do {
--------------------------------------------------------
Let's combine this with yours :-)
Werner
--
This is a majordomo managed list. To unsubscribe, send a message with
the body 'unsubscribe linux-mm me@address' to: majordomo@kvack.org
^ 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