diff options
-rw-r--r-- | src/mem/cache/tags/base.cc | 2 | ||||
-rw-r--r-- | src/mem/cache/tags/lru.cc | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/mem/cache/tags/base.cc b/src/mem/cache/tags/base.cc index 8c6c145ca..41cc11b23 100644 --- a/src/mem/cache/tags/base.cc +++ b/src/mem/cache/tags/base.cc @@ -88,7 +88,7 @@ BaseTags::regStats(const string &name) ; occupancies - .init(cache->numCpus()) + .init(cache->numCpus() + 1) .name(name + ".occ_blocks") .desc("Average occupied blocks per context") .flags(nozero | nonan) diff --git a/src/mem/cache/tags/lru.cc b/src/mem/cache/tags/lru.cc index 0da2a72e9..0667c5428 100644 --- a/src/mem/cache/tags/lru.cc +++ b/src/mem/cache/tags/lru.cc @@ -162,6 +162,8 @@ LRU::findVictim(Addr addr, PacketList &writebacks) if (blk->contextSrc != -1) { occupancies[blk->contextSrc % cache->numCpus()]--; blk->contextSrc = -1; + } else { + occupancies[cache->numCpus()]--; } DPRINTF(CacheRepl, "set %x: selecting blk %x for replacement\n", @@ -188,8 +190,10 @@ LRU::insertBlock(Addr addr, BlkType *blk, int context_src) // deal with what we are bringing in if (context_src != -1) { occupancies[context_src % cache->numCpus()]++; - blk->contextSrc = context_src; + } else { + occupancies[cache->numCpus()]++; } + blk->contextSrc = context_src; unsigned set = extractSet(addr); sets[set].moveToHead(blk); @@ -206,6 +210,8 @@ LRU::invalidateBlk(BlkType *blk) if (blk->contextSrc != -1) { occupancies[blk->contextSrc % cache->numCpus()]--; blk->contextSrc = -1; + } else { + occupancies[cache->numCpus()]--; } } } |