Page Coloring Defines in vm_page.h

Matthew Dillon dillon at apollo.backplane.com
Tue Jun 24 15:12:11 PDT 2003


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



More information about the freebsd-hackers mailing list