On real exclusive use of L1/L2 caches
Mar. 21st, 2013 07:52 am![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Just published an article on habrahabr regarding a common misconception:
When looking at a block diagram

one may think that L1 and L2 caches are exclusive for use by each corresponding core. So if some data comes there, it stays until it is replaced by other data requested by the same core.
In fact, in some specific workloads, some cores may be using LLC so extensively, that their data will evict other cores data from LLC. And as LLC is fully inclusive, this eviction will invalidate corresponding cache lines in L2 and L1. This is obvious when reading documentation carefully, and it is easy to demonstrate by running a simple test I described in an article.
When looking at a block diagram

one may think that L1 and L2 caches are exclusive for use by each corresponding core. So if some data comes there, it stays until it is replaced by other data requested by the same core.
In fact, in some specific workloads, some cores may be using LLC so extensively, that their data will evict other cores data from LLC. And as LLC is fully inclusive, this eviction will invalidate corresponding cache lines in L2 and L1. This is obvious when reading documentation carefully, and it is easy to demonstrate by running a simple test I described in an article.