Re: [RFC] Limit the size of the pagecache

From: Vaidyanathan Srinivasan
Date: Wed Jan 24 2007 - 07:34:05 EST




Christoph Lameter wrote:
> This is a patch using some of Aubrey's work plugging it in what is IMHO
> the right way. Feel free to improve on it. I have gotten repeatedly
> requests to be able to limit the pagecache. With the revised VM statistics
> this is now actually possile. I'd like to know more about possible uses of
> such a feature.
>
>

[snip]

Hi Christoph,

With your patch, MMAP of a file that will cross the pagecache limit hangs the
system. As I mentioned in my previous mail, without subtracting the
NR_FILE_MAPPED, the reclaim will infinitely try and fail.

I have tested your patch with the attached fix on my PPC64 box.

Signed-off-by: Vaidyanathan Srinivasan <svaidy@xxxxxxxxxxxxxxxxxx>

---
mm/page_alloc.c | 3 ++-
mm/vmscan.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)

--- linux-2.6.20-rc5.orig/mm/page_alloc.c
+++ linux-2.6.20-rc5/mm/page_alloc.c
@@ -1171,7 +1171,8 @@ zonelist_scan:
goto try_next_zone;

if ((gfp_mask & __GFP_PAGECACHE) &&
- zone_page_state(zone, NR_FILE_PAGES) >
+ (zone_page_state(zone, NR_FILE_PAGES) -
+ zone_page_state(zone, NR_FILE_MAPPED)) >
zone->max_pagecache_pages)
goto try_next_zone;

--- linux-2.6.20-rc5.orig/mm/vmscan.c
+++ linux-2.6.20-rc5/mm/vmscan.c
@@ -936,7 +936,8 @@ static unsigned long shrink_zone(int pri
* If the page cache is too big then focus on page cache
* and ignore anonymous pages
*/
- if (sc->may_swap && zone_page_state(zone, NR_FILE_PAGES)
+ if (sc->may_swap && (zone_page_state(zone, NR_FILE_PAGES) -
+ zone_page_state(zone, NR_FILE_MAPPED))
> zone->max_pagecache_pages)
sc->may_swap = 0;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/