Commit 74356a2c authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

Revert "[oilpan] Fix for EsimateLiveSize"

This reverts commit aceb7d67.

Reason for revert: Even though the heuristic seems off we tuned parameters around it that will trigger GCs. 

Bug: 852413

Original change's description:
> [oilpan] Fix for EsimateLiveSize
> 
> Take current value for base size, similarly to what is used for
> PartitionAlloc. This makes sure that an esimate is computed at the time
> of calling the method.
> 
> Bug: chromium:840789
> Change-Id: Iab7e63f5395cbc74226cd786d420c6145fdb7dd9
> Reviewed-on: https://chromium-review.googlesource.com/1094822
> Reviewed-by: Kentaro Hara <haraken@chromium.org>
> Reviewed-by: Keishi Hattori <keishi@chromium.org>
> Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#565967}

TBR=haraken@chromium.org,keishi@chromium.org,hpayer@chromium.org,mlippautz@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: chromium:840789
Change-Id: I323527b2f6d4703773ca11f980a4233cb8554f7a
Reviewed-on: https://chromium-review.googlesource.com/1100435Reviewed-by: default avatarMichael Lippautz <mlippautz@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#567131}
parent cef2ea9d
...@@ -394,30 +394,30 @@ size_t ThreadState::TotalMemorySize() { ...@@ -394,30 +394,30 @@ size_t ThreadState::TotalMemorySize() {
} }
size_t ThreadState::EstimatedLiveSize(size_t estimation_base_size, size_t ThreadState::EstimatedLiveSize(size_t estimation_base_size,
size_t size_at_prev_gc) { size_t size_at_last_gc) {
const ThreadHeapStatsCollector& stats_collector = *heap_->stats_collector(); const ThreadHeapStatsCollector& stats_collector = *heap_->stats_collector();
const ThreadHeapStatsCollector::Event& prev = stats_collector.previous(); const ThreadHeapStatsCollector::Event& prev = stats_collector.previous();
if (prev.wrapper_count_before_sweeping == 0) if (prev.wrapper_count_before_sweeping == 0)
return estimation_base_size; return estimation_base_size;
// (estimated size) = (estimation base size) - // (estimated size) = (estimation base size) - (heap size at the last GC) /
// (heap size at the last GC) * // (# of persistent handles at the last GC) *
// (# of persistent handles collected since the last GC) / // (# of persistent handles collected since the last GC)
// (# of persistent handles at the last GC) size_t size_retained_by_collected_persistents = static_cast<size_t>(
size_t size_freed_by_collecting_persistents = 1.0 * size_at_last_gc / prev.wrapper_count_before_sweeping *
static_cast<size_t>(static_cast<double>(size_at_prev_gc) * stats_collector.collected_wrapper_count());
stats_collector.collected_wrapper_count() / if (estimation_base_size < size_retained_by_collected_persistents)
prev.wrapper_count_before_sweeping);
if (estimation_base_size < size_freed_by_collecting_persistents)
return 0; return 0;
return estimation_base_size - size_freed_by_collecting_persistents; return estimation_base_size - size_retained_by_collected_persistents;
} }
double ThreadState::HeapGrowingRate() { double ThreadState::HeapGrowingRate() {
const size_t current_size = heap_->stats_collector()->object_size_in_bytes(); const size_t current_size = heap_->stats_collector()->object_size_in_bytes();
const size_t estimated_size = EstimatedLiveSize( // TODO(mlippautz): Clarify those two parameters below.
current_size, heap_->stats_collector()->previous().marked_bytes); const size_t estimated_size =
EstimatedLiveSize(heap_->stats_collector()->previous().marked_bytes,
heap_->stats_collector()->previous().marked_bytes);
// If the estimatedSize is 0, we set a high growing rate to trigger a GC. // If the estimatedSize is 0, we set a high growing rate to trigger a GC.
double growing_rate = double growing_rate =
......
...@@ -649,15 +649,7 @@ class PLATFORM_EXPORT ThreadState { ...@@ -649,15 +649,7 @@ class PLATFORM_EXPORT ThreadState {
// conservative GC was performed to handle the emergency. // conservative GC was performed to handle the emergency.
bool ForceMemoryPressureGCIfNeeded(); bool ForceMemoryPressureGCIfNeeded();
// Esimates the size of a heap based on |size_at_prev_gc| and wrapper counts size_t EstimatedLiveSize(size_t current_size, size_t size_at_last_gc);
// (live and collected). |current_size| should be the currently allocated size
// for that heap.
//
// Note that this function should not be called while sweeping is running as
// it uses snapshots and live values collected during garbage collection and
// calling it during sweeping mixes garbage collection cycles.
size_t EstimatedLiveSize(size_t current_size, size_t size_at_prev_gc);
size_t TotalMemorySize(); size_t TotalMemorySize();
double HeapGrowingRate(); double HeapGrowingRate();
double PartitionAllocGrowingRate(); double PartitionAllocGrowingRate();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment