Re: Non Power of 2 Cache Sizes
- From: anton@xxxxxxxxxxxxxxxxxxxxxxxxxx (Anton Ertl)
- Date: Wed, 17 Aug 2005 17:45:01 GMT
Sander Vesik <sander@xxxxxxxxxxxxxxxxxxx> writes:
>Terje Mathisen <terje.mathisen@xxxxxxxxxxxxx> wrote:
>>
>> All caches use (extremely simple) hash functions. Doing mod(prime)
>> instead of mod(2^n) just reduces the number of bad interactions. :-)
>
>using mod for the hash is probably fundamentaly wrong way to
>go about it though.
Why?
Apart from being simple to implement, the mod approach has the
following benefits:
- Its performance effects (in particular, the worst-case performance)
are relatively easy to understand, making it easy to avoid them.
- Spatial locality performs well with it. If I have, e.g., a 4KB way
size, then I know that I can access a 4KB array without incurring any
conflict misses. If, OTOH, i had a random-style hash function, even
two cache lines that are adjacent in virtual address space could
conflict with each other. BTW, that's one of the benefits of using
page colouring over arbitrary page mapping: It performs better in the
presence of spatial locality. Of course, with enough associativity in
the cache, it does not matter.
- anton
--
M. Anton Ertl Some things have to be seen to be believed
anton@xxxxxxxxxxxxxxxxxxxxxxxxxx Most things have to be believed to be seen
http://www.complang.tuwien.ac.at/anton/home.html
.
- Follow-Ups:
- Re: Non Power of 2 Cache Sizes
- From: Nick Maclaren
- Re: Non Power of 2 Cache Sizes
- References:
- Non Power of 2 Cache Sizes
- From: Vikas Mishra
- Re: Non Power of 2 Cache Sizes
- From: Terje Mathisen
- Re: Non Power of 2 Cache Sizes
- From: Nick Maclaren
- Re: Non Power of 2 Cache Sizes
- From: Terje Mathisen
- Re: Non Power of 2 Cache Sizes
- From: Sander Vesik
- Non Power of 2 Cache Sizes
- Prev by Date: Re: Non Power of 2 Cache Sizes
- Next by Date: Re: Non Power of 2 Cache Sizes
- Previous by thread: Re: Non Power of 2 Cache Sizes
- Next by thread: Re: Non Power of 2 Cache Sizes
- Index(es):
Relevant Pages
|