Date: Wed, 10 Oct 2007 21:36:01 +0400 From: Igor Sysoev <is@rambler-co.ru> To: David G Lawrence <dg@dglawrence.com> Cc: Kostik Belousov <kostikbel@gmail.com>, freebsd-current@freebsd.org, Antony Mawer <fbsd-current@mawer.org> Subject: Re: sendfile and page usage statistics Message-ID: <20071010173601.GB35652@rambler-co.ru> In-Reply-To: <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> <20071010102756.GE56714@tnn.dglawrence.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Oct 10, 2007 at 03:27:56AM -0700, David G Lawrence wrote: > > > 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. The read() from file certainly updates vnode pages' PG_A/PG_REFERENCED, because coping to userland is made by CPU. I think write() does the same. I consider sendfile() as send() of mmap()ed file with the difference that user process does not see this mmap(). -- Igor Sysoev http://sysoev.ru/en/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071010173601.GB35652>