Reducing write-backs to memory by controlling the age of cache lines in lower level cache
A method and apparatus for reducing write-backs to memory is disclosed herein. The method includes determining whether a read/write request entering a lower level cache is a cache line containing modified data, and responsive to determining that the read/write request is not a cache line containing modified data, manipulating age information of the cache line to reduce a number of write-backs to memory.
1. A method for reducing write-backs to memory, comprising:
determining whether a read request entering a lower level cache is directed to a clean cache line without modified data;
responsive to determining that the read request is directed to the clean cache line, maintaining an age information of the clean cache line by not updating the age information of the clean cache line to reduce a number of write-backs to memory;
determining whether the read request entering the lower level cache is directed to a dirty cache line containing modified data;
responsive to determining that the read request is directed to the dirty cache line containing modified data, updating an age information of the dirty cache line; and
responsive to determining that the read request is not present in the lower level cache, evicting a least recently used cache line from a plurality of non-updated age information clean cache lines and a plurality of updated age information dirty cache lines.
2. A system, comprising:
a processor; and
a memory storing program code, which, when executed on the processor, performs an operation for managing memory, the operation comprising:
determining whether a read request entering a lower level cache is directed to a clean cache line without modified data;
responsive to determining that the read request is directed to the clean cache line, maintaining an age information of the clean cache line by not updating the age information of the clean cache line to reduce a number of write-backs to memory;
determining whether the read request entering the lower level cache is directed to a dirty cache line containing modified data;
responsive to determining that the read request is directed to the dirty cache line containing modified data, updating an age information of the dirty cache line; and
responsive to determining that the read request is not present in the lower level cache, evicting a least recently used cache line from a plurality of non-updated age information clean cache lines and a plurality of updated age information dirty cache lines.
3. A non-transitory computer readable storage medium having stored thereon instructions that when executed by a processor causes a processor to perform an operation for managing memory, comprising:
determining whether a read request entering a lower level cache is directed to a clean cache line without modified data;
responsive to determining that the read request is directed to the clean cache line, maintaining an age information of the clean cache line by not updating the age information of the clean cache line to reduce a number of write-backs to memory;
determining whether the read request entering the lower level cache is directed to a dirty cache line containing modified data;
responsive to determining that the read request is directed to the dirty cache line containing modified data, updating an age information of the dirty cache line; and
responsive to determining that the read request is not present in the lower level cache, evicting a least recently used cache line from a plurality of non-updated age information clean cache lines and a plurality of updated age information dirty cache lines.