From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422906AbXCOP5V (ORCPT ); Thu, 15 Mar 2007 11:57:21 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1422905AbXCOP5V (ORCPT ); Thu, 15 Mar 2007 11:57:21 -0400 Received: from mx1.redhat.com ([66.187.233.31]:49890 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422906AbXCOP5U (ORCPT ); Thu, 15 Mar 2007 11:57:20 -0400 Message-ID: <45F96CCB.4000709@redhat.com> Date: Thu, 15 Mar 2007 11:56:59 -0400 From: Chuck Ebbert Organization: Red Hat User-Agent: Thunderbird 1.5.0.9 (X11/20070212) MIME-Version: 1.0 To: Ashif Harji CC: linux-mm@kvack.org, Nick Piggin , Jan Kara , linux-kernel@vger.kernel.org, akpm@linux-foundation.org Subject: Re: [PATCH] mm/filemap.c: unconditionally call mark_page_accessed References: <20070312142012.GH30777@atrey.karlin.mff.cuni.cz> <20070312143900.GB6016@wotan.suse.de> <20070312151355.GB23532@duck.suse.cz> <20070312173500.GF23532@duck.suse.cz> <20070313185554.GA5105@duck.suse.cz> In-Reply-To: Content-Type: multipart/mixed; boundary="------------060500060806000801000906" Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org This is a multi-part message in MIME format. --------------060500060806000801000906 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Ashif Harji wrote: > > This patch unconditionally calls mark_page_accessed to prevent pages, > especially for small files, from being evicted from the page cache > despite frequent access. > > Signed-off-by: Ashif Harji > I like mine better -- it leaves the comment: --------------060500060806000801000906 Content-Type: text/plain; name="linux-2.6-fix_mark_page_accessed.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="linux-2.6-fix_mark_page_accessed.patch" From: Chuck Ebbert Always mark page as accessed when reading multiple times. Original idea and patch by Ashif Harji Signed-off-by: Chuck Ebbert --- 2.6.20.2-t.orig/mm/filemap.c +++ 2.6.20.2-t/mm/filemap.c @@ -887,7 +887,6 @@ unsigned long offset; unsigned long last_index; unsigned long next_index; - unsigned long prev_index; loff_t isize; struct page *cached_page; int error; @@ -896,7 +895,6 @@ cached_page = NULL; index = *ppos >> PAGE_CACHE_SHIFT; next_index = index; - prev_index = ra.prev_page; last_index = (*ppos + desc->count + PAGE_CACHE_SIZE-1) >> PAGE_CACHE_SHIFT; offset = *ppos & ~PAGE_CACHE_MASK; @@ -945,11 +943,9 @@ /* * When (part of) the same page is read multiple times - * in succession, only mark it as accessed the first time. + * in succession, always mark it accessed. */ - if (prev_index != index) - mark_page_accessed(page); - prev_index = index; + mark_page_accessed(page); /* * Ok, we have the page, and it's up-to-date, so --------------060500060806000801000906--