From c4ea7f7d5a852dc9ac32cb4c9668114425779dac Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Wed, 14 Nov 2018 06:58:53 +0000 Subject: [PATCH] Bug 1507035 - Fix run sizes for size classes >= 16KB on systems with large pages. r=njn Differential Revision: https://phabricator.services.mozilla.com/D11836 --HG-- extra : moz-landing-system : lando --- memory/build/mozjemalloc.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/memory/build/mozjemalloc.cpp b/memory/build/mozjemalloc.cpp index 981df89e5d7d..ac309e53e19c 100644 --- a/memory/build/mozjemalloc.cpp +++ b/memory/build/mozjemalloc.cpp @@ -2890,11 +2890,6 @@ arena_bin_t::Init(SizeClass aSizeClass) } while (kFixedHeaderSize + (sizeof(unsigned) * try_mask_nelms) > try_reg0_offset); - // Don't allow runs larger than the largest possible large size class. - if (try_run_size > gMaxLargeClass) { - break; - } - // Try to keep the run overhead below kRunOverhead. if (Fraction(try_reg0_offset, try_run_size) <= kRunOverhead) { break; @@ -2921,6 +2916,13 @@ arena_bin_t::Init(SizeClass aSizeClass) break; } + // If next iteration is going to be larger than the largest possible large + // size class, then we didn't find a setup where the overhead is small enough, + // and we can't do better than the current settings, so just use that. + if (try_run_size + gPageSize > gMaxLargeClass) { + break; + } + // Try more aggressive settings. try_run_size += gPageSize; }