diff options
author | Patrick Williams <iawillia@us.ibm.com> | 2014-02-24 16:21:31 -0600 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2014-03-02 13:23:13 -0600 |
commit | 4c1eb65cfcec7141d464ba12d4d39dae638c4ef9 (patch) | |
tree | aef53c2671db11e79878f26d7505b532441aad52 /src | |
parent | 448fd374e20c0d2a0d1554e590385eb78af3dfab (diff) | |
download | talos-hostboot-4c1eb65cfcec7141d464ba12d4d39dae638c4ef9.tar.gz talos-hostboot-4c1eb65cfcec7141d464ba12d4d39dae638c4ef9.zip |
Resolve OOM due to Stampeding Herd issue in PageMgr.
Change-Id: Iccf938f8d2ee2b56747a6e266ced3ec957b6a46e
CQ: SW247870
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/9120
Tested-by: Jenkins Server
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Reviewed-by: Douglas R. Gilbert <dgilbert@us.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/include/kernel/pagemgr.H | 4 | ||||
-rw-r--r-- | src/kernel/pagemgr.C | 20 |
2 files changed, 20 insertions, 4 deletions
diff --git a/src/include/kernel/pagemgr.H b/src/include/kernel/pagemgr.H index b05e0b237..320347872 100644 --- a/src/include/kernel/pagemgr.H +++ b/src/include/kernel/pagemgr.H @@ -5,7 +5,7 @@ /* */ /* IBM CONFIDENTIAL */ /* */ -/* COPYRIGHT International Business Machines Corp. 2010,2013 */ +/* COPYRIGHT International Business Machines Corp. 2010,2014 */ /* */ /* p1 */ /* */ @@ -219,7 +219,7 @@ class PageManager uint64_t iv_pagesAvail; //!< free pages (for debug) uint64_t iv_pagesTotal; //!< Total number o fpages - uint64_t iv_lock; //!< lock for checking low heap + Spinlock iv_lock; //!< lock for allocating PageManagerCore iv_heap; //!< Main heap PageManagerCore iv_heapKernel; //!< kernel heap for out-of-mem diff --git a/src/kernel/pagemgr.C b/src/kernel/pagemgr.C index 3c05fc6ab..ae1029125 100644 --- a/src/kernel/pagemgr.C +++ b/src/kernel/pagemgr.C @@ -5,7 +5,7 @@ /* */ /* IBM CONFIDENTIAL */ /* */ -/* COPYRIGHT International Business Machines Corp. 2010,2013 */ +/* COPYRIGHT International Business Machines Corp. 2010,2014 */ /* */ /* p1 */ /* */ @@ -185,7 +185,7 @@ uint64_t PageManager::availPages() } PageManager::PageManager() - : iv_pagesAvail(0), iv_pagesTotal(0), iv_lock(0) + : iv_pagesAvail(0), iv_pagesTotal(0), iv_lock() { this->_initialize(); } @@ -295,8 +295,24 @@ void PageManager::_initialize() void* PageManager::_allocatePage(size_t n, bool userspace) { + // The allocator was designed to be lockless. We have ran into a problem + // in Brazos where all threads (over 256) were trying to allocate a page + // at the same time. This resulted in many of them trying to break a large + // page chunk into smaller fragments. The later threads ended up seeing + // no chunks available and claimed we were out of memory. + // + // Simple solution is to just put a lock around the page allocation. All + // calls to this function are guarenteed, by PageManager::allocatePage, to + // be from kernel space so we cannot run into any dead lock situations by + // using a spinlock here. + // + // RTC: 98271 + iv_lock.lock(); + PageManagerCore::page_t* page = iv_heap.allocatePage(n); + iv_lock.unlock(); + // If the allocation came from kernel-space and normal allocation // was unsuccessful, pull a page off the reserve heap. if ((NULL == page) && (!userspace)) |