summaryrefslogtreecommitdiffstats
path: root/src/kernel
diff options
context:
space:
mode:
authorMatthew Barth <msbarth@us.ibm.com>2011-10-20 15:49:12 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2011-10-25 15:12:23 -0500
commit0ad20184aec21ef0560a9eee7e7c26a36ace07e1 (patch)
treebb402e0c2342a791074fde9939701a1bbf9dedef /src/kernel
parent5ab488739184f2b2649193e3f9da695ee334d04f (diff)
downloadtalos-hostboot-0ad20184aec21ef0560a9eee7e7c26a36ace07e1.tar.gz
talos-hostboot-0ad20184aec21ef0560a9eee7e7c26a36ace07e1.zip
Update kernel 'EVICT' pages path to cast out pages when low on memory.
Change-Id: I79b9cfad5d80267c6709b094d7f852d89e08534b Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/452 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/kernel')
-rw-r--r--src/kernel/basesegment.C5
-rw-r--r--src/kernel/block.C72
-rw-r--r--src/kernel/pagemgr.C5
-rw-r--r--src/kernel/syscall.C2
4 files changed, 23 insertions, 61 deletions
diff --git a/src/kernel/basesegment.C b/src/kernel/basesegment.C
index dee18600a..3e45b72ef 100644
--- a/src/kernel/basesegment.C
+++ b/src/kernel/basesegment.C
@@ -201,10 +201,7 @@ int BaseSegment::_mmSetPermission(void* i_va, uint64_t i_size, uint64_t i_access
void BaseSegment::castOutPages(uint64_t i_type)
{
- size_t cast_out = 0;
- cast_out = iv_block->castOutPages(i_type);
- // Could try again with a more agressive constraint if cast_out == 0 ????
- if(cast_out) printkd("Cast out %ld pages,Type=%ld\n",cast_out,i_type);
+ iv_block->castOutPages(i_type);
}
/**
* STATIC
diff --git a/src/kernel/block.C b/src/kernel/block.C
index 5b1520b1b..bdec164de 100644
--- a/src/kernel/block.C
+++ b/src/kernel/block.C
@@ -117,15 +117,6 @@ bool Block::handlePageFault(task_t* i_task, uint64_t i_addr)
}
else
{
- // Test code @TODO remove - SET up ro pages to test cast out pages
- //if(pte->getPage() == 0)
- //{
- // void* l_page = PageManager::allocatePage();
- // memset(l_page,'U',PAGESIZE);
- // pte->setPageAddr(reinterpret_cast<uint64_t>(l_page));
- // pte->setPresent(true);
- // pte->setWritable(false);
- //}
return false; //TODO - Swap kernel base block pages for user pages
}
}
@@ -319,50 +310,25 @@ void Block::updateRefCount( uint64_t i_vaddr,
}
// track the changed/dirty bit
- spte->setDirty( i_stats.C );
-
-}
-
-
-bool Block::evictPage(ShadowPTE* i_pte)
-{
- ShadowPTE* pte = i_pte;
- bool do_cast_out = false;
-
- if(!pte->isWritable()) // ro, executable
- {
- do_cast_out = true;
- }
- else // is writable...
+ if (i_stats.C)
{
- // if pte->isWriteTracked() flush then cast out
+ spte->setDirty( i_stats.C );
}
-
- if(do_cast_out)
- {
- PageTableManager::delEntry(pte->getPageAddr());
- PageManager::freePage(reinterpret_cast<void*>(pte->getPageAddr()));
- pte->setPresent(false);
- pte->setPageAddr(NULL);
- }
-
- return do_cast_out;
}
-size_t Block::castOutPages(uint64_t i_type)
+void Block::castOutPages(uint64_t i_type)
{
- size_t cast_out = 0;
+ void* l_vaddr = NULL;
// drill down
if(iv_nextBlock)
{
- cast_out += iv_nextBlock->castOutPages(i_type);
+ iv_nextBlock->castOutPages(i_type);
}
// TODO We will eventually need to skip other blocks as well, such as
// when the memory space grows.
if(iv_baseAddr != 0) // Skip base area
{
- bool is_cast_out = false;
size_t rw_constraint = 5;
size_t ro_constraint = 3;
@@ -386,9 +352,12 @@ size_t Block::castOutPages(uint64_t i_type)
if(pte->isWritable())
{
- if((pte->getLRU() > rw_constraint) && pte->isWriteTracked())
+ if(pte->getLRU() > rw_constraint && pte->isWriteTracked())
{
- is_cast_out = evictPage(pte);
+ //'EVICT' single page
+ l_vaddr = reinterpret_cast<void*>(page);
+ this->removePages(VmmManager::EVICT,l_vaddr,
+ PAGESIZE,NULL);
//printk("+");
}
}
@@ -396,22 +365,15 @@ size_t Block::castOutPages(uint64_t i_type)
{
if(pte->getLRU() > ro_constraint)
{
- is_cast_out = evictPage(pte);
+ //'EVICT' single page
+ l_vaddr = reinterpret_cast<void*>(page);
+ this->removePages(VmmManager::EVICT,l_vaddr,
+ PAGESIZE,NULL);
}
}
-
- if(is_cast_out)
- {
- //printk("-");
- ++cast_out;
- is_cast_out = false;
- }
}
}
- //printk("\n");
}
-
- return cast_out;
}
int Block::mmSetPermission(uint64_t i_va, uint64_t i_size,uint64_t i_access_type)
@@ -566,10 +528,7 @@ int Block::removePages(VmmManager::PAGE_REMOVAL_OPS i_op, void* i_vaddr,
else if (pte->isDirty() && !pte->isWriteTracked() &&
i_op == VmmManager::EVICT)
{
- //Leave as 'printk' to note page was skipped
- printk("Block::removePages >> Unable to EVICT ");
- printk("dirty page thats not write tracked: ");
- printk("va: 0x%.16lX, pa: 0x%.16lX \n",l_vaddr, pageAddr);
+ //Skip page
}
else if (i_op != VmmManager::FLUSH)
{
@@ -584,6 +543,7 @@ int Block::removePages(VmmManager::PAGE_REMOVAL_OPS i_op, void* i_vaddr,
void Block::releasePTE(ShadowPTE* i_pte)
{
+ i_pte->setDirty(false);
i_pte->setPresent(false);
i_pte->setPageAddr(NULL);
}
diff --git a/src/kernel/pagemgr.C b/src/kernel/pagemgr.C
index 82e743ef1..ca5dca055 100644
--- a/src/kernel/pagemgr.C
+++ b/src/kernel/pagemgr.C
@@ -51,6 +51,11 @@ uint64_t PageManager::queryAvail()
return Singleton<PageManager>::instance()._queryAvail();
}
+uint64_t PageManager::availPages()
+{
+ return Singleton<PageManager>::instance()._availPages();
+}
+
PageManager::PageManager() : iv_pagesAvail(0), iv_pagesTotal(0)
{
// Determine first page of un-allocated memory
diff --git a/src/kernel/syscall.C b/src/kernel/syscall.C
index 87cfba6bd..ca32657cf 100644
--- a/src/kernel/syscall.C
+++ b/src/kernel/syscall.C
@@ -61,7 +61,7 @@ void kernel_execute_decrementer()
#endif
KernelMisc::shutdown();
}
-
+ CpuManager::executePeriodics(c);
s->setNextRunnable();
}
OpenPOWER on IntegriCloud