Bug 1284651. Allow the image surface cache to grow beyond 1GB on 64bit builds with sufficient memory. r=aosmond
☠☠ backed out by 093599edfef8 ☠ ☠
authorTimothy Nikkel <tnikkel@gmail.com>
Mon, 09 Sep 2019 23:44:58 +0000
changeset 553751 3519c255f86ede2d7ebf06ac9df7dd29a1a3eeea
parent 553749 7762fb7ccd1d45652f06ac7c4298efcd1fe83b9a
child 553752 e302a2dfc55b5cd44961ab7e55d549205a3c6d1c
push id12169
push userffxbld-merge
push dateMon, 14 Oct 2019 16:59:29 +0000
treeherdermozilla-beta@c819687300ed [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaosmond
bugs1284651
milestone71.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 1284651. Allow the image surface cache to grow beyond 1GB on 64bit builds with sufficient memory. r=aosmond Before this patch: surface cache size = min(1GB, system_memory/4) After this patch: surface cache size = min(32bit ? 1GB : 2GB , system_memory/4) sizeof(uintptr_t) is the best I can figure out to detect 32bit builds. Differential Revision: https://phabricator.services.mozilla.com/D45092
image/SurfaceCache.cpp
modules/libpref/init/StaticPrefList.yaml
--- a/image/SurfaceCache.cpp
+++ b/image/SurfaceCache.cpp
@@ -1386,16 +1386,21 @@ void SurfaceCache::Initialize() {
   // memory we're using, and so forth. We clamp it to avoid division by zero.
   uint32_t surfaceCacheDiscardFactor =
       max(StaticPrefs::image_mem_surfacecache_discard_factor_AtStartup(), 1u);
 
   // Maximum size of the surface cache, in kilobytes.
   uint64_t surfaceCacheMaxSizeKB =
       StaticPrefs::image_mem_surfacecache_max_size_kb_AtStartup();
 
+  if (sizeof(uintptr_t) <= 4) {
+    // Limit surface cache to 1 GB if our address space is 32 bit.
+    surfaceCacheMaxSizeKB = 1024 * 1024;
+  }
+
   // A knob determining the actual size of the surface cache. Currently the
   // cache is (size of main memory) / (surface cache size factor) KB
   // or (surface cache max size) KB, whichever is smaller. The formula
   // may change in the future, though.
   // For example, a value of 4 would yield a 256MB cache on a 1GB machine.
   // The smallest machines we are likely to run this code on have 256MB
   // of memory, which would yield a 64MB cache on this setting.
   // We clamp this value to avoid division by zero.
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -3745,17 +3745,17 @@
 - name: image.mem.surfacecache.discard_factor
   type: uint32_t
   value: 1
   mirror: once
 
 # Maximum size for the surface cache, in kilobytes.
 - name: image.mem.surfacecache.max_size_kb
   type: uint32_t
-  value: 1024 * 1024
+  value: 2024 * 1024
   mirror: once
 
 # Minimum timeout for expiring unused images from the surface cache, in
 # milliseconds. This controls how long we store cached temporary surfaces.
 - name: image.mem.surfacecache.min_expiration_ms
   type: uint32_t
   value: 60*1000
   mirror: once