From owner-freebsd-current@FreeBSD.ORG Wed Oct 10 06:06:12 2007 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 829A816A41B for ; Wed, 10 Oct 2007 06:06:12 +0000 (UTC) (envelope-from is@rambler-co.ru) Received: from relay0.rambler.ru (relay0.rambler.ru [81.19.66.187]) by mx1.freebsd.org (Postfix) with ESMTP id 4026913C48A for ; Wed, 10 Oct 2007 06:06:12 +0000 (UTC) (envelope-from is@rambler-co.ru) Received: from relay0.rambler.ru (localhost [127.0.0.1]) by relay0.rambler.ru (Postfix) with ESMTP id 3FB4C31BA4 for ; Wed, 10 Oct 2007 10:06:10 +0400 (MSD) Received: from localhost (is1.park.rambler.ru [81.19.64.121]) by relay0.rambler.ru (Postfix) with ESMTP id EBA78318B4 for ; Wed, 10 Oct 2007 10:06:09 +0400 (MSD) Date: Wed, 10 Oct 2007 10:06:06 +0400 From: Igor Sysoev To: freebsd-current@freebsd.org Message-ID: <20071010060605.GB18931@rambler-co.ru> References: <20071009125001.GC5758@rambler-co.ru> <20071010055748.GA18931@rambler-co.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20071010055748.GA18931@rambler-co.ru> User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: No virus found Subject: Re: sendfile and page usage statistics X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2007 06:06:12 -0000 On Wed, Oct 10, 2007 at 09:57:48AM +0400, Igor Sysoev wrote: > On Tue, Oct 09, 2007 at 04:50:01PM +0400, Igor Sysoev wrote: > > > As I understand if sendfile() with hardware TX chsum or TSO are used, > > then CPU does not touch file pages at all. So pagedaemon never set > > PG_REFERENCED to vnode object pages while scanning them. > > Does VM set PG_REFERENCED by another way ? Otherwise, often used files > > that accessed by sendfile() only have small chances to be cached by VM. > > I have looked kern_sendfile() in CURRENT and it seems to me that > PG_REFERENCED is never set when sendfile() gets cached vm_page. > I have looked the code path: > > vm_page_grab() > vm_page_lookup() > vm_page_wire() > sf_buf_alloc() on i386 and amd64 > > and have not seen PG_REFERENCED. As I understand the following patch against uipc_syscalls.c should fix the bug to some extent: if (pg->valid && vm_page_is_valid(pg, pgoff, xfsize)) + vm_page_flag_set(pg, PG_REFERENCED); VM_OBJECT_UNLOCK(obj); else if (m != NULL) -- Igor Sysoev http://sysoev.ru/en/