From owner-freebsd-current@FreeBSD.ORG Wed Oct 10 11:08:10 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 BB13416A418 for ; Wed, 10 Oct 2007 11:08:10 +0000 (UTC) (envelope-from dg@dglawrence.com) Received: from dglawrence.com (static-72-90-113-2.ptldor.fios.verizon.net [72.90.113.2]) by mx1.freebsd.org (Postfix) with ESMTP id 9663813C461 for ; Wed, 10 Oct 2007 11:08:09 +0000 (UTC) (envelope-from dg@dglawrence.com) Received: from tnn.dglawrence.com (localhost [127.0.0.1]) by dglawrence.com (8.14.1/8.14.1) with ESMTP id l9AAS0tj041127; Wed, 10 Oct 2007 03:28:00 -0700 (PDT) (envelope-from dg@dglawrence.com) Received: (from dg@localhost) by tnn.dglawrence.com (8.14.1/8.14.1/Submit) id l9AARuvd041126; Wed, 10 Oct 2007 03:27:56 -0700 (PDT) (envelope-from dg@dglawrence.com) X-Authentication-Warning: tnn.dglawrence.com: dg set sender to dg@dglawrence.com using -f Date: Wed, 10 Oct 2007 03:27:56 -0700 From: David G Lawrence To: Igor Sysoev Message-ID: <20071010102756.GE56714@tnn.dglawrence.com> References: <20071009125001.GC5758@rambler-co.ru> <20071010055748.GA18931@rambler-co.ru> <20071010060605.GB18931@rambler-co.ru> <470C6DD4.1060509@mawer.org> <20071010062541.GA23840@rambler-co.ru> <20071010093436.GB2180@deviant.kiev.zoral.com.ua> <20071010095018.GA28123@rambler-co.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20071010095018.GA28123@rambler-co.ru> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (dglawrence.com [127.0.0.1]); Wed, 10 Oct 2007 03:28:00 -0700 (PDT) Cc: Kostik Belousov , freebsd-current@freebsd.org, Antony Mawer 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 11:08:10 -0000 > > But I think that the actual patch is wrong. The PG_REFERENCED bit shall > > be set when hardware access bit is set on pte. You patch would set it in > > advance. > > The problem is that ethernet card that does TX chsum, DMA and TSO never > sets PG_A, so sendfile() should set it in advance. > > I'm going to test the patch on machine where all files takes more memory > than physical memory and there are some popular files. > > I espect to see > 1) increased active memory. > 2) decreased number i/o. I would say that it is far from clear that this change would result in better performance. It is generally the case in FreeBSD that we bias in favor of executable pages (usually the image itself as its pages are executed, but also the image data pages). Pages involved in regular file I/O take a back seat. This is because a regular file is accessed typically in one burst, whereas an executable page is accessed in small chunks over a much larger period of time (and thus is affected more by a cache miss). Thus, PG_REFERENCED gets set for pages that are mmaped, but not for pages involved in read, write, sendfile, etc. Different workloads of course will have different behavior. One side effect of this will likely be much more system paging activity as sendfile causes process pages to be pushed out of memory in favor of cached file data. This is generally a bad thing and would result in reduced interactive performance. -DG David G. Lawrence President Download Technologies, Inc. - http://www.downloadtech.com - (866) 399 8500 The FreeBSD Project - http://www.freebsd.org Pave the road of life with opportunities.