From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933573AbXCOTzu (ORCPT ); Thu, 15 Mar 2007 15:55:50 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S933590AbXCOTzt (ORCPT ); Thu, 15 Mar 2007 15:55:49 -0400 Received: from services106.cs.uwaterloo.ca ([129.97.152.164]:41454 "EHLO services106.cs.uwaterloo.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933573AbXCOTzs (ORCPT ); Thu, 15 Mar 2007 15:55:48 -0400 Date: Thu, 15 Mar 2007 15:55:08 -0400 (EDT) From: Ashif Harji To: Nick Piggin cc: Chuck Ebbert , linux-mm@kvack.org, Jan Kara , linux-kernel@vger.kernel.org, akpm@linux-foundation.org, Andrew Morton , Rik van Riel Subject: Re: [PATCH] mm/filemap.c: unconditionally call mark_page_accessed In-Reply-To: <20070315162944.GI8321@wotan.suse.de> Message-ID: 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> <45F96CCB.4000709@redhat.com> <20070315162944.GI8321@wotan.suse.de> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0 (services106.cs.uwaterloo.ca [129.97.152.132]); Thu, 15 Mar 2007 15:55:24 -0400 (EDT) X-Miltered: at psyche with ID 45F9A4A7.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-UUID: ceddd8fb-a0fc-434a-b277-a61eeab40d8d Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 15 Mar 2007, Nick Piggin wrote: > On Thu, Mar 15, 2007 at 11:56:59AM -0400, Chuck Ebbert wrote: >> 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: > > How about this? It also doesn't break the use-once heuristic. > > -- > A change to make database style random read() workloads perform better, by > calling mark_page_accessed for some non-page-aligned reads broke the case of > < PAGE_CACHE_SIZE files, which will not get their prev_index moved past the > first page. > > Combine both heuristics for marking the page accessed. > > Signed-off-by: Nick Piggin > > Index: linux-2.6/mm/filemap.c > =================================================================== > --- linux-2.6.orig/mm/filemap.c > +++ linux-2.6/mm/filemap.c > @@ -929,7 +929,7 @@ page_ok: > * When (part of) the same page is read multiple times > * in succession, only mark it as accessed the first time. > */ > - if (prev_index != index) > + if (prev_index != index || !offset) > mark_page_accessed(page); > prev_index = index; > > It sounds like people are happy with the fix suggested by Nick. That fix is okay with me as it fixes the problem I am having. I suspect, however, that by not directly detecting the problematic access pattern, where the file is accessed sequentially in small hunks, other applications may experience performance problems related to caching. For example, if an application frequently and non-sequentially reads from the same page. This is especially true for files of size < PAGE_CACHE_SIZE. But, I'm not sure if such an access pattern likely. ashif.