L2 cache and data not filled in again once it's out
Posted: Wed Feb 06, 2019 10:10 am
I tested a bit to try and see what algorithm is used for L2 cache.
Mainly it seems like LRU.
However, I did notice a bug (feature?) - once data falls out of L2 cache, it cannot get cached again (even if using or not using L1 with L2).
With using only L1 I did not notice same problem though.
I flushed windows cache between each copy/test so no Windows OS caching is messing the results (RamMap by Sysinternals helps here ).
For simplified test, set L1 to 0, L2 to 1GB.
Copy file with size let's say 900MB.
It gets into L2.
Copy again, it's read from L2.
Copy now some new file, let's say size 4GB.
Part of it is in L2, although whole 4GB was (re)written in L2 (another issue I opened some time ago).
Now copy initial file. It's not in L2 anymore (expected), but after reading it, it's not copied into L2 again (no write to L2).
Even several consecutive reads will not make it go into L2 again, which is not expected behavior.
Tried this with large file, and with directory full of tiny files.
Maybe there's something else going on, but it would be nice to know how L2 works, and if this indeed is a bug.
Mainly it seems like LRU.
However, I did notice a bug (feature?) - once data falls out of L2 cache, it cannot get cached again (even if using or not using L1 with L2).
With using only L1 I did not notice same problem though.
I flushed windows cache between each copy/test so no Windows OS caching is messing the results (RamMap by Sysinternals helps here ).
For simplified test, set L1 to 0, L2 to 1GB.
Copy file with size let's say 900MB.
It gets into L2.
Copy again, it's read from L2.
Copy now some new file, let's say size 4GB.
Part of it is in L2, although whole 4GB was (re)written in L2 (another issue I opened some time ago).
Now copy initial file. It's not in L2 anymore (expected), but after reading it, it's not copied into L2 again (no write to L2).
Even several consecutive reads will not make it go into L2 again, which is not expected behavior.
Tried this with large file, and with directory full of tiny files.
Maybe there's something else going on, but it would be nice to know how L2 works, and if this indeed is a bug.