Re: [RFC] Limit the size of the pagecache

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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 <[email protected]>

---
 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux