diff options
author | Daniel <odanrc@yahoo.com.br> | 2019-04-22 11:32:22 +0200 |
---|---|---|
committer | Daniel Carvalho <odanrc@yahoo.com.br> | 2019-04-22 22:17:10 +0000 |
commit | 382263c6706296fee2548f74fd4b811553106dba (patch) | |
tree | 28c21239e815f9f54adf9108afc0166b2ebaaec4 /src/mem | |
parent | 620d1c6f72733e87062a51c5f9d3e7fd6324f543 (diff) | |
download | gem5-382263c6706296fee2548f74fd4b811553106dba.tar.xz |
mem-cache: Fix fix of replacement count
Commit 7976b561de61b7523ca9a860154ad7ba701d12a7 tried fixing
replacement update when a single location can be associated to
multiple blocks.
Although the comment of the correct action was added, the proper
validation check was forgotten. This change adds that check and
moves doing the eviction to when there is a valid block.
Change-Id: I31d8bb914ccfd1849e9d97464d70a58a62f59533
Signed-off-by: Daniel <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18210
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'src/mem')
-rw-r--r-- | src/mem/cache/base.cc | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/mem/cache/base.cc b/src/mem/cache/base.cc index 849cff598..554a61eb0 100644 --- a/src/mem/cache/base.cc +++ b/src/mem/cache/base.cc @@ -1307,8 +1307,11 @@ BaseCache::allocateBlock(const PacketPtr pkt, PacketList &writebacks) // Check for transient state allocations. If any of the entries listed // for eviction has a transient state, the allocation fails + bool replacement = false; for (const auto& blk : evict_blks) { if (blk->isValid()) { + replacement = true; + Addr repl_addr = regenerateBlkAddr(blk); MSHR *repl_mshr = mshrQueue.findMatch(repl_addr, blk->isSecure()); if (repl_mshr) { @@ -1326,27 +1329,23 @@ BaseCache::allocateBlock(const PacketPtr pkt, PacketList &writebacks) // The victim will be replaced by a new entry, so increase the replacement // counter if a valid block is being replaced - if (evict_blks.size() > 0) { + if (replacement) { + // Evict valid blocks associated to this victim block for (const auto& blk : evict_blks) { if (blk->isValid()) { DPRINTF(CacheRepl, "Evicting %s (%#llx) to make room for " \ "%#llx (%s)\n", blk->print(), regenerateBlkAddr(blk), addr, is_secure); - } - } - replacements++; - } + if (blk->wasPrefetched()) { + unusedPrefetches++; + } - // Evict valid blocks associated to this victim block - for (const auto& blk : evict_blks) { - if (blk->isValid()) { - if (blk->wasPrefetched()) { - unusedPrefetches++; + evictBlock(blk, writebacks); } - - evictBlock(blk, writebacks); } + + replacements++; } // Insert new block at victimized entry |