From owner-freebsd-hackers Fri Jul 21 12:44:12 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from boreas.isi.edu (boreas.isi.edu [128.9.160.161]) by hub.freebsd.org (Postfix) with ESMTP id A464F37BE6E for ; Fri, 21 Jul 2000 12:44:06 -0700 (PDT) (envelope-from larse@ISI.EDU) Received: from isi.edu (hbo.isi.edu [128.9.160.75]) by boreas.isi.edu (8.9.3/8.9.3) with ESMTP id MAA01630; Fri, 21 Jul 2000 12:44:03 -0700 (PDT) Message-ID: <3978A802.E05CC45@isi.edu> Date: Fri, 21 Jul 2000 12:44:02 -0700 From: Lars Eggert Organization: USC Information Sciences Institute X-Mailer: Mozilla 4.73 [en] (X11; I; FreeBSD 4.1-RC i386) X-Accept-Language: en, de MIME-Version: 1.0 To: Matt Dillon Cc: Alan Cox , hackers@FreeBSD.ORG, cort@cs.nmt.edu Subject: Re: clearing pages in the idle loop References: <20000719234124.H14543@cs.rice.edu> <39788E48.60F8A59F@isi.edu> <200007211906.MAA19989@earth.backplane.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Matt Dillon wrote: > > :Alan Cox wrote: > :> Last year, I tried to reproduce some of the claims/results > :> in this paper on FreeBSD/x86 and couldn't. I also tried > :> limiting the idle loop to clearing pages of one particular > :... > : > :> Finally, it's possible that having these pre-zeroed pages > :> in your L2 cache might be beneficial if they get allocated > :> and used right away. FreeBSD's idle loop zeroes the pages > :> that are next in line for allocation. > : > :That makes sense. Other factors that may have an impact: > : > : * if you always have enough zeroed pages remaining over your > : benchmark (> ~1/2 free pages), FreeBSD will never do the > : idle-time zeroing > : > : * it looks to me as if Cort's Linux code will always zero whole > : pages, while the FreeBSD code is a little smarter and only zeroes > : used regions of a page (less impact on caches?) > : > Since the only effect of a cache miss is less efficient use of > the cpu, and since the page zeroing only occurs when the cpu is idle, > I would not expect to see much improvement from attempts to refine > the page-zeroing operation (beyond the simple hysteresis that FreeBSD > uses now and perhaps being able to bypass the cache). The reason why I'm interested in Cort's results is that I'd like to extend processing in the idle loop to other things (see my other mail). Cort measured a performance decrease of foreground processing, due to polluted caches after idle-time processing. We're discussing if disabling caches during the idle loop may prevent that. > The real benefit occurs on a medium-to-heavily loaded machine which is > NOT cpu bound. Since nearly all page allocations require zero'd pages, > having a pool of pre-zero'd pages significantly reduces allocation > latency at just the time the process doing the allocation can best > benefit from it. In a cpu-bound system, the idle loop does not run > as often (or at all) and no pre-zeroing occurs anyway. I agree. However, on a medium-to-heavily loaded CPU, you'd probably see the largest decrease of foreground performance, as the idle times are short and bursty, and so your caches may get polluted more frequently. (Assuming cache pollution is in fact a problem; Allan seems to not think so.) If Allan still has his patches, I'll run some experiments, so we have some numbers to talk about. Maybe it doesn't matter. > In regards to just zeroing the pieces of a page that need zeroing - this > is NOT an optimization designed for the idle-loop page-zeroing code. I made a mistake tracing through the code. Sorry. But it may be interesting to speculate if this would speed things up. Would probably require MMU support though. Lars -- Lars Eggert Information Sciences Institute http://www.isi.edu/larse/ University of Southern California To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message