2 ms·
> In most architectures, the caches are physically addressed, so TLB lookups occur before even L1 cache access. So to see if a memory location is contained in
by MrBuddyCasino 7y ago
> In most architectures, the caches are physically addressed, so TLB lookups occur before even L1 cache access.
So to see if a memory location is contained in a cache line, a TLB lookup is needed to first get the physical address? I wouldn't have expected this, can you expand on why this is the case?
- pwildani 7y agoIf you use virtual addresses to index your caches, you have to clear them all on every process context switch. With physical addresses, you just have to clear your TLB cache.
- dooglius 7y agoSee Linus Torvalds' thesis, section 4.3.3 "The case against virtual data caches": https://www.cs.helsinki.fi/u/kutvonen/index_files/linus.pdf https://www.cs.helsinki.fi/u/kutvonen/index_files/linus.pdf
- adwn 7y agoTwo reasons: 1) a virtual address might refer to different physical addresses (see pwildani's comment), and 2) a physical address can be mapped to different virtual addresses – a virtually addresses cache has to keep track of that somehow, otherwise the cache will become incoherent.