[heap] Relax condition for forced finalization of incremental marking.
Forcing finalization after reaching allocation limit regresses gc pause time in benchmarks as we have to do a lot of non-incremental marking work. This patch allows overshoot of the limit by some margin. BUG=chromium:670675,chromium:671994 TBR=mlippautz@chromium.org Review-Url: https://codereview.chromium.org/2554423005 Cr-Commit-Position: refs/heads/master@{#41625}
This commit is contained in:
parent
25189ffc36
commit
a6976211d1
@ -265,7 +265,7 @@ GarbageCollector Heap::SelectGarbageCollector(AllocationSpace space,
|
||||
}
|
||||
|
||||
if (incremental_marking()->NeedsFinalization() &&
|
||||
OldGenerationSpaceAvailable() == 0) {
|
||||
AllocationLimitOvershotByLargeMargin()) {
|
||||
*reason = "Incremental marking needs finalization";
|
||||
return MARK_COMPACTOR;
|
||||
}
|
||||
@ -5320,7 +5320,7 @@ bool Heap::ShouldExpandOldGenerationOnSlowAllocation() {
|
||||
if (ShouldOptimizeForMemoryUsage()) return false;
|
||||
|
||||
if (incremental_marking()->NeedsFinalization()) {
|
||||
return false;
|
||||
return !AllocationLimitOvershotByLargeMargin();
|
||||
}
|
||||
|
||||
if (incremental_marking()->IsStopped() &&
|
||||
|
@ -1823,6 +1823,19 @@ class Heap {
|
||||
static_cast<size_t>(PromotedTotalSize());
|
||||
}
|
||||
|
||||
// We allow incremental marking to overshoot the allocation limit for
|
||||
// performace reasons. If the overshoot is too large then we are more
|
||||
// eager to finalize incremental marking.
|
||||
inline bool AllocationLimitOvershotByLargeMargin() {
|
||||
if (old_generation_allocation_limit_ >= PromotedTotalSize()) return false;
|
||||
uint64_t overshoot = PromotedTotalSize() - old_generation_allocation_limit_;
|
||||
// Overshoot margin is 50% of allocation limit or half-way to the max heap.
|
||||
uint64_t margin =
|
||||
Min(old_generation_allocation_limit_ / 2,
|
||||
(max_old_generation_size_ - old_generation_allocation_limit_) / 2);
|
||||
return overshoot >= margin;
|
||||
}
|
||||
|
||||
void UpdateTotalGCTime(double duration);
|
||||
|
||||
bool MaximumSizeScavenge() { return maximum_size_scavenges_ > 0; }
|
||||
|
Loading…
Reference in New Issue
Block a user