summaryrefslogtreecommitdiffstats
path: root/src/kernel/block.C
diff options
context:
space:
mode:
authorDan Crowell <dcrowell@us.ibm.com>2011-08-08 09:36:04 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2011-09-06 12:18:36 -0500
commitf093b902e49a0ee46d232cd196ec48f88f801735 (patch)
treec6d540acf79d21e21c936a381968e4158fee29c7 /src/kernel/block.C
parentdcf7c7f2c3be17df41e3cc483dbec6f085b05353 (diff)
downloadtalos-hostboot-f093b902e49a0ee46d232cd196ec48f88f801735.tar.gz
talos-hostboot-f093b902e49a0ee46d232cd196ec48f88f801735.zip
Adding a basic interface and implementation to the Segment/Block
path to update the LRU statistics when the PageTableManager code clears the reference bit. This is not meant to be a complete implementation (different Task is open for that). This is Task 3400. Change-Id: If67efd16ead6f68a74f5f5a698013c1b852864d9 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/231 Tested-by: Jenkins Server Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/kernel/block.C')
-rw-r--r--src/kernel/block.C43
1 files changed, 40 insertions, 3 deletions
diff --git a/src/kernel/block.C b/src/kernel/block.C
index 1402bd60a..59a7892f2 100644
--- a/src/kernel/block.C
+++ b/src/kernel/block.C
@@ -32,7 +32,7 @@
#include <kernel/vmmmgr.H>
#include <kernel/ptmgr.H>
#include <kernel/pagemgr.H>
-//#include <kernel/console.H>
+#include <kernel/console.H>
Block::~Block()
{
@@ -235,6 +235,7 @@ void Block::setPageAllocateFromZero(uint64_t i_vAddr)
else
{
// No block owns this address. Code bug.
+ printk("setPageAllocateFromZero> i_vaddr=0x%.lX\n", i_vAddr );
kassert(iv_nextBlock);
}
return;
@@ -247,10 +248,10 @@ void Block::setPageAllocateFromZero(uint64_t i_vAddr)
void Block::releaseAllPages()
{
- // Release all pages from page table.
+ // Release all pages from page table.
PageTableManager::delRangeVA(iv_baseAddr, iv_baseAddr + iv_size);
- // Free all pages back to page manager.
+ // Free all pages back to page manager.
for(uint64_t page = iv_baseAddr;
page < (iv_baseAddr + iv_size);
page += PAGESIZE)
@@ -264,3 +265,39 @@ void Block::releaseAllPages()
}
}
}
+
+void Block::updateRefCount( uint64_t i_vaddr,
+ PageTableManager::UsageStats_t i_stats )
+{
+ // Check containment, call down chain if address isn't in this block.
+ if (!isContained(i_vaddr))
+ {
+ if (iv_nextBlock)
+ {
+ iv_nextBlock->updateRefCount(i_vaddr, i_stats);
+ }
+ else
+ {
+ // No block owns this address. Code bug.
+ printk("updateRefCount> i_vaddr=0x%.lX\n", i_vaddr );
+ kassert(iv_nextBlock);
+ }
+ return;
+ }
+
+ ShadowPTE* spte = getPTE(i_vaddr);
+
+ // Adjust the LRU statistics
+ if( i_stats.R )
+ {
+ spte->zeroLRU();
+ }
+ else
+ {
+ spte->incLRU();
+ }
+
+ // track the changed/dirty bit
+ spte->setDirty( i_stats.C );
+
+}
OpenPOWER on IntegriCloud