diff options
author | 2017-10-16 21:50:02 +0000 | |
---|---|---|
committer | 2017-10-16 21:50:02 +0000 | |
commit | 26d46e51a8c387d26e7971857e26f4582b936204 (patch) | |
tree | d8309e595cae7ad347a1cdda845bdd26365a05a7 | |
parent | f856934689a289b2bc82462e8757a170242bb44d (diff) | |
parent | 11c273ddfda3e30d14af32e385570955b61bc39b (diff) |
Merge "Remove low RAM special casing for heap growth multiplier"
-rw-r--r-- | runtime/gc/heap.cc | 9 | ||||
-rw-r--r-- | runtime/parsed_options.cc | 2 | ||||
-rw-r--r-- | runtime/runtime.cc | 16 |
3 files changed, 18 insertions, 9 deletions
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc index 4004af2875..67e8a0d02f 100644 --- a/runtime/gc/heap.cc +++ b/runtime/gc/heap.cc @@ -132,10 +132,6 @@ static constexpr uint32_t kAllocSpaceBeginForDeterministicAoT = 0x40000000; // Dump the rosalloc stats on SIGQUIT. static constexpr bool kDumpRosAllocStatsOnSigQuit = false; -// Extra added to the heap growth multiplier. Used to adjust the GC ergonomics for the read barrier -// config. -static constexpr double kExtraHeapGrowthMultiplier = kUseReadBarrier ? 1.0 : 0.0; - static const char* kRegionSpaceName = "main space (region space)"; // If true, we log all GCs in the both the foreground and background. Used for debugging. @@ -255,8 +251,7 @@ Heap::Heap(size_t initial_size, min_free_(min_free), max_free_(max_free), target_utilization_(target_utilization), - foreground_heap_growth_multiplier_( - foreground_heap_growth_multiplier + kExtraHeapGrowthMultiplier), + foreground_heap_growth_multiplier_(foreground_heap_growth_multiplier), total_wait_time_(0), verify_object_mode_(kVerifyObjectModeDisabled), disable_moving_gc_count_(0), @@ -3428,7 +3423,7 @@ collector::GarbageCollector* Heap::FindCollectorByGcType(collector::GcType gc_ty double Heap::HeapGrowthMultiplier() const { // If we don't care about pause times we are background, so return 1.0. - if (!CareAboutPauseTimes() || IsLowMemoryMode()) { + if (!CareAboutPauseTimes()) { return 1.0; } return foreground_heap_growth_multiplier_; diff --git a/runtime/parsed_options.cc b/runtime/parsed_options.cc index 9841a95746..71d7b6c34d 100644 --- a/runtime/parsed_options.cc +++ b/runtime/parsed_options.cc @@ -121,7 +121,7 @@ std::unique_ptr<RuntimeParser> ParsedOptions::MakeParser(bool ignore_unrecognize .WithType<double>().WithRange(0.1, 0.9) .IntoKey(M::HeapTargetUtilization) .Define("-XX:ForegroundHeapGrowthMultiplier=_") - .WithType<double>().WithRange(0.1, 1.0) + .WithType<double>().WithRange(0.1, 5.0) .IntoKey(M::ForegroundHeapGrowthMultiplier) .Define("-XX:ParallelGCThreads=_") .WithType<unsigned int>() diff --git a/runtime/runtime.cc b/runtime/runtime.cc index 8eb4a07b64..7f2f7895db 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -174,6 +174,11 @@ static constexpr double kLowMemoryMinLoadFactor = 0.5; static constexpr double kLowMemoryMaxLoadFactor = 0.8; static constexpr double kNormalMinLoadFactor = 0.4; static constexpr double kNormalMaxLoadFactor = 0.7; + +// Extra added to the default heap growth multiplier. Used to adjust the GC ergonomics for the read +// barrier config. +static constexpr double kExtraDefaultHeapGrowthMultiplier = kUseReadBarrier ? 1.0 : 0.0; + Runtime* Runtime::instance_ = nullptr; struct TraceConfig { @@ -1152,13 +1157,22 @@ bool Runtime::Init(RuntimeArgumentMap&& runtime_options_in) { // agents_.push_back(lib); // } + float foreground_heap_growth_multiplier; + if (is_low_memory_mode_ && !runtime_options.Exists(Opt::ForegroundHeapGrowthMultiplier)) { + // If low memory mode, use 1.0 as the multiplier by default. + foreground_heap_growth_multiplier = 1.0f; + } else { + foreground_heap_growth_multiplier = + runtime_options.GetOrDefault(Opt::ForegroundHeapGrowthMultiplier) + + kExtraDefaultHeapGrowthMultiplier; + } XGcOption xgc_option = runtime_options.GetOrDefault(Opt::GcOption); heap_ = new gc::Heap(runtime_options.GetOrDefault(Opt::MemoryInitialSize), runtime_options.GetOrDefault(Opt::HeapGrowthLimit), runtime_options.GetOrDefault(Opt::HeapMinFree), runtime_options.GetOrDefault(Opt::HeapMaxFree), runtime_options.GetOrDefault(Opt::HeapTargetUtilization), - runtime_options.GetOrDefault(Opt::ForegroundHeapGrowthMultiplier), + foreground_heap_growth_multiplier, runtime_options.GetOrDefault(Opt::MemoryMaximumSize), runtime_options.GetOrDefault(Opt::NonMovingSpaceCapacity), runtime_options.GetOrDefault(Opt::Image), |