diff options
author | Patrick Williams <iawillia@us.ibm.com> | 2012-07-06 15:40:43 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2012-07-11 08:18:41 -0500 |
commit | 14a2721d2c87dc13f1ef66818c41cd0848dd52db (patch) | |
tree | 66ae0220b0443f9a87d87075279ba9a5c08ba412 /src/include/kernel/pagemgr.H | |
parent | a23283c6facfee055c9c6d43e23a04ca02edc467 (diff) | |
download | talos-hostboot-14a2721d2c87dc13f1ef66818c41cd0848dd52db.tar.gz talos-hostboot-14a2721d2c87dc13f1ef66818c41cd0848dd52db.zip |
Live-lock issues in memory allocator.
* Debug tool for PageManager.
* Support PageMgr allocations of non-2^k size.
* Switch page-allocation to always be in kernel-mode.
While investigating issue 44511, I noticed two problesm with the
memory page allocator (PageManager). First, the allocator did
not support allocations of pages which were not a power of 2,
which would result in pages appearing to "leak". Second, in
situations where a large allocation was requested and there was
not a large chunk available, the allocation would enter a
live-lock condition where coalescing would never occur.
Switched the PageManager so that all allocations happen in
kernel space. This allows us to force memory-release operations
on the syscall path when we are out of memory and also put in
place a task_yield call which will allow coalescing to eventually
occur. Issue 44523 is suppose to fully resolve any of these
live-lock paths.
RTC: 44511
Change-Id: Ifefd5d0996ee6914e291c862fac0c7b76980717f
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/1330
Tested-by: Jenkins Server
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/include/kernel/pagemgr.H')
-rw-r--r-- | src/include/kernel/pagemgr.H | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/include/kernel/pagemgr.H b/src/include/kernel/pagemgr.H index 6676a469c..93cd82bb5 100644 --- a/src/include/kernel/pagemgr.H +++ b/src/include/kernel/pagemgr.H @@ -54,7 +54,7 @@ class PageManagerCore /** * Default Constructor */ - PageManagerCore() + PageManagerCore() : iv_available(0) {} /** @@ -76,7 +76,7 @@ class PageManagerCore * @return a pointer to the requested allocation | NULL * if the request could not be satisfied. */ - page_t * allocatePage( size_t i_pageCount ); + page_t * allocatePage( size_t i_pageCount ); /** * Return page allocations to the page manager @@ -136,9 +136,10 @@ class PageManager /** * Allocate pages * @param[in] n, Requested allocation in pages + * @param[in] userspace - Request to allocate came from userspace * @return pointer to requested memory */ - static void* allocatePage(size_t n = 1); + static void* allocatePage(size_t n = 1, bool userspace = false); /** * Return pages to the pagemanager @@ -170,6 +171,9 @@ class PageManager { MEMLEN = VmmManager::MBOX_DMA_ADDR, RESERVED_PAGES = 4, + + LOWMEM_NORM_LIMIT = 16, + LOWMEM_CRIT_LIMIT = 5, }; static size_t cv_coalesce_count; //!< running coalesced counter @@ -182,15 +186,9 @@ class PageManager private: - void* _allocatePage(size_t); //!< see allocatePage() - void _freePage(void*, size_t); //!< see freePage() - void _coalesce( void ); //!< see coalesce() - - /** - * Query if in kernel mode - * @return [true | false] - */ - bool queryKernelMode() const; + void* _allocatePage(size_t,bool); //!< see allocatePage() + void _freePage(void*, size_t); //!< see freePage() + void _coalesce( void ); //!< see coalesce() /** see queryAvail() */ ALWAYS_INLINE uint64_t _queryAvail() const |