Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751319AbXAXMdt (ORCPT ); Wed, 24 Jan 2007 07:33:49 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751321AbXAXMdt (ORCPT ); Wed, 24 Jan 2007 07:33:49 -0500 Received: from ausmtp05.au.ibm.com ([202.81.18.154]:37325 "EHLO ausmtp05.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751319AbXAXMds (ORCPT ); Wed, 24 Jan 2007 07:33:48 -0500 Message-ID: <45B75208.90208@linux.vnet.ibm.com> Date: Wed, 24 Jan 2007 18:03:12 +0530 From: Vaidyanathan Srinivasan Organization: IBM User-Agent: Thunderbird 1.5.0.5 (X11/20060728) MIME-Version: 1.0 To: Christoph Lameter CC: Aubrey Li , Nick Piggin , Robin Getz , "Henn, erich, Michael" , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [RFC] Limit the size of the pagecache References: In-Reply-To: Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2155 Lines: 56 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 --- 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/