tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Non power-of-two cache sizes and page colouring

Hi folks,

I've got a machine here with 6MB of cache (an Intel E5420), and this
cache size confuses the page colouring code..  I end up with 96 colours,
and then we form a mask based on this which is where the problems
start...  The failure symtoms are UVM saying that the machine is out of
RAM while vmstat(1) says there's still half the memory available.

I can think of a few solutions to this:

 1- Adjust the colouring code to use modulus instead of masks.  mod is
    probably too slow an operation though for this to be an option?

 2- Adjust number of colours down to next lowest power of two.  This
    would bias two thirds of the cache to fit in half the colours,
    and the other third of the cache to fit in the other half of the

 3- Adjust number of colours down to next lowest power of two that is
    a divisor of the suggested number of colours (in my example adjust
    from 96 to 32).

I'm using a hard-coded version of #3 now (wiring down 32 colours) and
that is working fine on said machine.  Naively, I think that #3 makes
the most sense, but I'll research it a bit more.

I'll make a proper patch that does that.  Unless anyone wants to suggest
a better way?  :-)


Home | Main Index | Thread Index | Old Index