diff options
author | Dan Crowell <dcrowell@us.ibm.com> | 2019-02-10 13:12:10 -0600 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2019-02-12 16:24:46 -0600 |
commit | a733a70261d1c847e3130c509cc911f86d71453d (patch) | |
tree | 2d7b267b41bd857a52fbcd149e10fb75fdbee2a5 /src/kernel/pagemgr.C | |
parent | 4d92ae4d4ac17899bb2a521dc82cc0de09608478 (diff) | |
download | talos-hostboot-a733a70261d1c847e3130c509cc911f86d71453d.tar.gz talos-hostboot-a733a70261d1c847e3130c509cc911f86d71453d.zip |
Add more agressive memory allocation calls
If we hit a situation where we can't allocate a page of memory,
this will force a coalesce (defrag) a few times and then
eventually trigger other memory reclamation actions.
Also tweaked a few spots in the kernel to enhance debug:
- add more stops to look at errors (HB_BREAK_ON_ERROR)
- add more backtrace calls
- add a new debug flag to count the extra coalesce calls
Change-Id: Ibac7079a44a12dc61e41304de4c4ae518c206d13
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/71653
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Reviewed-by: Matt Derksen <mderkse1@us.ibm.com>
Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/kernel/pagemgr.C')
-rw-r--r-- | src/kernel/pagemgr.C | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/kernel/pagemgr.C b/src/kernel/pagemgr.C index bfc1bbf7a..ee3a3ff39 100644 --- a/src/kernel/pagemgr.C +++ b/src/kernel/pagemgr.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2010,2018 */ +/* Contributors Listed Below - COPYRIGHT 2010,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -39,11 +39,12 @@ #include <kernel/bltohbdatamgr.H> #include <kernel/misc.H> #include <usr/debugpointers.H> +#include <kernel/cpumgr.H> size_t PageManager::cv_coalesce_count = 0; size_t PageManager::cv_low_page_count = -1; - +size_t PageManager::cv_alloc_coalesce_count = 0; void PageManagerCore::addMemory( size_t i_addr, size_t i_pageCount ) { @@ -165,10 +166,11 @@ void* PageManager::allocatePage(size_t n, bool userspace) // Didn't successfully allocate, so yield in hopes that memory // will eventually free up (ex. VMM flushes). + constexpr size_t MAX_ATTEMPTS = 10000; if (NULL == page) { l_attempts++; - if( l_attempts == 10000 ) + if( l_attempts == MAX_ATTEMPTS ) { printk( "Cannot allocate %ld pages to %d!\n", n, task_gettid() ); @@ -176,7 +178,25 @@ void* PageManager::allocatePage(size_t n, bool userspace) KernelMisc::printkBacktrace(nullptr); task_crash(); } + task_yield(); + + // Force a defrag of the memory 10 times + if( l_attempts % (MAX_ATTEMPTS/10) == 0 ) + { + printkd( "Forcing coalesce to allocate %ld pages to %d!\n", + n, task_gettid() ); + coalesce(); + ++PageManager::cv_alloc_coalesce_count; + } + + // Try to evict some pages once + if( l_attempts == MAX_ATTEMPTS/2 ) + { + printkd( "Forcing periodics to allocate %ld pages to %d!\n", + n, task_gettid() ); + CpuManager::forceMemoryPeriodic(); + } } } } @@ -496,4 +516,7 @@ void PageManager::_addDebugPointers() DEBUG::add_debug_pointer(DEBUG::PAGEMANAGERCOALESCECOUNT, &PageManager::cv_coalesce_count, sizeof(PageManager::cv_coalesce_count)); + DEBUG::add_debug_pointer(DEBUG::PAGEMANAGERALLOCCOUNT, + &PageManager::cv_alloc_coalesce_count, + sizeof(PageManager::cv_alloc_coalesce_count)); } |