Bug 1542290 - Decommit unused base_page allocations. r=glandium
authorGian-Carlo Pascutto <gcp@mozilla.com>
Tue, 16 Apr 2019 11:04:21 +0000
changeset 469859 bc25508285184d50fb58523c0c83a6fdf9b96ad7
parent 469858 6b754628d15922d6f564ea222fbb0d90135e25a9
child 469860 23a77e063257414dd78aeb70d59e29cd68aa3295
push id35883
push userbtara@mozilla.com
push dateWed, 17 Apr 2019 21:47:29 +0000
treeherdermozilla-central@02b89c29412b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1542290
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1542290 - Decommit unused base_page allocations. r=glandium Differential Revision: https://phabricator.services.mozilla.com/D26327
memory/build/mozjemalloc.cpp
--- a/memory/build/mozjemalloc.cpp
+++ b/memory/build/mozjemalloc.cpp
@@ -1325,21 +1325,19 @@ static bool base_pages_alloc(size_t mins
     return true;
   }
   base_next_addr = base_pages;
   base_past_addr = (void*)((uintptr_t)base_pages + csize);
   // Leave enough pages for minsize committed, since otherwise they would
   // have to be immediately recommitted.
   pminsize = PAGE_CEILING(minsize);
   base_next_decommitted = (void*)((uintptr_t)base_pages + pminsize);
-#if defined(MALLOC_DECOMMIT)
   if (pminsize < csize) {
     pages_decommit(base_next_decommitted, csize - pminsize);
   }
-#endif
   base_mapped += csize;
   base_committed += pminsize;
 
   return false;
 }
 
 static void* base_alloc(size_t aSize) {
   void* ret;
@@ -1357,23 +1355,22 @@ static void* base_alloc(size_t aSize) {
   }
   // Allocate.
   ret = base_next_addr;
   base_next_addr = (void*)((uintptr_t)base_next_addr + csize);
   // Make sure enough pages are committed for the new allocation.
   if ((uintptr_t)base_next_addr > (uintptr_t)base_next_decommitted) {
     void* pbase_next_addr = (void*)(PAGE_CEILING((uintptr_t)base_next_addr));
 
-#ifdef MALLOC_DECOMMIT
     if (!pages_commit(
             base_next_decommitted,
             (uintptr_t)pbase_next_addr - (uintptr_t)base_next_decommitted)) {
       return nullptr;
     }
-#endif
+
     base_committed +=
         (uintptr_t)pbase_next_addr - (uintptr_t)base_next_decommitted;
     base_next_decommitted = pbase_next_addr;
   }
 
   return ret;
 }