From owner-freebsd-current@FreeBSD.ORG Wed Oct 10 06:45:40 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 21DA016A419 for ; Wed, 10 Oct 2007 06:45:40 +0000 (UTC) (envelope-from fbsd-current@mawer.org) Received: from outbound.icp-qv1-irony-out1.iinet.net.au (outbound.icp-qv1-irony-out1.iinet.net.au [203.59.1.108]) by mx1.freebsd.org (Postfix) with ESMTP id 9BBBE13C447 for ; Wed, 10 Oct 2007 06:45:39 +0000 (UTC) (envelope-from fbsd-current@mawer.org) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAADoLDEfLzq3r/2dsb2JhbAAM X-IronPort-AV: E=Sophos;i="4.21,252,1188748800"; d="scan'208";a="212953357" Received: from unknown (HELO [10.24.1.1]) ([203.206.173.235]) by outbound.icp-qv1-irony-out1.iinet.net.au with ESMTP; 10 Oct 2007 14:16:04 +0800 Message-ID: <470C6DD4.1060509@mawer.org> Date: Wed, 10 Oct 2007 16:14:44 +1000 From: Antony Mawer User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: Igor Sysoev References: <20071009125001.GC5758@rambler-co.ru> <20071010055748.GA18931@rambler-co.ru> <20071010060605.GB18931@rambler-co.ru> In-Reply-To: <20071010060605.GB18931@rambler-co.ru> Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-current@freebsd.org 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:45:40 -0000 On 10/10/2007 4:06 PM, Igor Sysoev wrote: > 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) You are missing opening/closing braces on your if() statement with this change... --Antony