From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 24 15:12:11 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1B95F37B401 for ; Tue, 24 Jun 2003 15:12:11 -0700 (PDT) Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id A38A443FF2 for ; Tue, 24 Jun 2003 15:12:10 -0700 (PDT) (envelope-from dillon@apollo.backplane.com) Received: from apollo.backplane.com (localhost [127.0.0.1]) by apollo.backplane.com (8.12.9/8.12.6) with ESMTP id h5OMBcVI095343; Tue, 24 Jun 2003 15:11:38 -0700 (PDT) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.12.9/8.12.6/Submit) id h5OMBb12095342; Tue, 24 Jun 2003 15:11:37 -0700 (PDT) Date: Tue, 24 Jun 2003 15:11:37 -0700 (PDT) From: Matthew Dillon Message-Id: <200306242211.h5OMBb12095342@apollo.backplane.com> To: Tim Kientzle References: <20030624111942.GO31354@spc.org> <3EF8900A.6030803@acm.org> cc: hackers@freebsd.org Subject: Re: Page Coloring Defines in vm_page.h X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jun 2003 22:12:11 -0000 : :Matthew Dillon wrote: :> For example, prime number 3 an array size 8 will scan the array in :> the following order N = (N + PRIME) & (ARRAY_SIZE_MASK). :> N = (N + 3) & 7: :> :> 0 3 6 1 4 7 2 5 ... 0 :> :> As you can see, all the array entries are covered before the sequence :> repeats. .... Only certain prime number / power-of-2-array size :> combinations have this effect, .... : :Ummmm.... Actually, Matt, the property you've stated is much more :common than you seem to believe. If you generate a sequence : N = ( N + Stride ) % ArraySize :then you will visit every element of (0 ... ArraySize-1) as long as I was just answering a question. Most people aren't interested in that level of detail (or, if they are, I'm sure Terry would happily chime in), they just want to know the purpose. -Matt