diff options
author | Patrick Williams <iawillia@us.ibm.com> | 2011-07-25 16:41:57 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2011-07-29 15:12:07 -0500 |
commit | a4ad138162e1c2b0e7ae008d38d91a0094393bd7 (patch) | |
tree | 7c3068ebd522d36a3f3e9083303e3cf66ac281a3 /src/kernel/pagemgr.C | |
parent | 786c6a4a3aa85bb9f240a86735eb8f6ac277c109 (diff) | |
download | talos-hostboot-a4ad138162e1c2b0e7ae008d38d91a0094393bd7.tar.gz talos-hostboot-a4ad138162e1c2b0e7ae008d38d91a0094393bd7.zip |
Reduce memory footprint to 3MB.
Change-Id: I309bc63bdb27baa21f65de05e12324b9c4ce3407
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/212
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/kernel/pagemgr.C')
-rw-r--r-- | src/kernel/pagemgr.C | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/kernel/pagemgr.C b/src/kernel/pagemgr.C index 9ca2821d6..95719b241 100644 --- a/src/kernel/pagemgr.C +++ b/src/kernel/pagemgr.C @@ -28,19 +28,19 @@ PageManager::PageManager() : iv_pagesAvail(0) uint64_t addr = (uint64_t) VFS_LAST_ADDRESS; if (0 != (addr % PAGESIZE)) addr = (addr - (addr % PAGESIZE)) + PAGESIZE; - + // Determine number of pages available. page_t* page = (page_t*)((void*) addr); size_t length = (MEMLEN - addr) / PAGESIZE; // Update statistics. __sync_add_and_fetch(&iv_pagesAvail, length); - + // Display. printk("Initializing PageManager with %zd pages starting at %lx...", length, (uint64_t)page); - + // Populate L3 cache lines. uint64_t* cache_line = (uint64_t*) addr; uint64_t* end_cache_line = (uint64_t*) VmmManager::FULL_MEM_SIZE; @@ -62,6 +62,9 @@ PageManager::PageManager() : iv_pagesAvail(0) length -= (1 << page_length); } + // @TODO: Venice: Clear 3-8MB region and add to free memory pool. + // Can't do this now due to fake-PNOR driver. + printk("done\n"); } @@ -69,7 +72,7 @@ void* PageManager::_allocatePage(size_t n) { size_t which_bucket = 0; while (n > (size_t)(1 << which_bucket)) which_bucket++; - + int retries = 0; page_t* page = (page_t*)NULL; while ((page == NULL) && (retries < 3)) @@ -109,11 +112,11 @@ void PageManager::_freePage(void* p, size_t n) PageManager::page_t* PageManager::pop_bucket(size_t n) { if (n >= BUCKETS) return NULL; - + page_t* p = first_page[n].pop(); if (NULL == p) - { + { // Couldn't allocate from the correct size bucket, so split up an // item from the next sized bucket. p = pop_bucket(n+1); |