Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Jun 2003 15:11:37 -0700 (PDT)
From:      Matthew Dillon <dillon@apollo.backplane.com>
To:        Tim Kientzle <kientzle@acm.org>
Cc:        hackers@freebsd.org
Subject:   Re: Page Coloring Defines in vm_page.h
Message-ID:  <200306242211.h5OMBb12095342@apollo.backplane.com>
References:  <20030624111942.GO31354@spc.org> <3EF8900A.6030803@acm.org>

next in thread | previous in thread | raw e-mail | index | archive | help

:
: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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200306242211.h5OMBb12095342>