summaryrefslogtreecommitdiffstats
path: root/src/kernel/pagemgr.C
diff options
context:
space:
mode:
authorPatrick Williams <iawillia@us.ibm.com>2014-02-24 16:21:31 -0600
committerA. Patrick Williams III <iawillia@us.ibm.com>2014-03-02 13:23:13 -0600
commit4c1eb65cfcec7141d464ba12d4d39dae638c4ef9 (patch)
treeaef53c2671db11e79878f26d7505b532441aad52 /src/kernel/pagemgr.C
parent448fd374e20c0d2a0d1554e590385eb78af3dfab (diff)
downloadtalos-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/kernel/pagemgr.C')
-rw-r--r--src/kernel/pagemgr.C20
1 files changed, 18 insertions, 2 deletions
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))
OpenPOWER on IntegriCloud