Closed Bug 1633752 Opened 4 years ago Closed 4 years ago

Increase non-incremental threshold for small heaps

Categories

(Core :: JavaScript: GC, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
mozilla77
Tracking Status
firefox77 --- fixed

People

(Reporter: jonco, Assigned: jonco)

References

Details

Attachments

(2 files)

There are a few reports of non-incremental GC slices showing up in profiles at the moment (bug 1627039, bug 1627839). What seems to be happening is that a high allocation rate during an incremental collections causes us to exceed the non-incremental threshold and so we finish the collection synchronously, resulting in noticeable pauses.

During an incremental collection the browser triggers slices during idle time. However there isn't always any idle time. As a fallback (and for the shell), the engine internally triggers slices based on allocation every time 1MB is allocated in a zone since the last GC slice. For smaller heap sizes this doesn't trigger enough slices before the non-incremental threshold is exceeded.

To address this we can calculate the non-incremental threshold dynamically based on heap size, with smaller heaps using a larger multiplier and therefore getting more opportunity to finish before we hit the threshold.

Blocks: 1627039
Blocks: 1627839

When I tested the main patch for this bug I got test failures in the gc/gcparam.js jit-test because of rounding errors converting GC parameters between integer percentages and floats in GCSchedulingTunables::setParameter. Making these all double fixes the problem, and it's the default floating point type in C++ anyway.

This adds a splits the non-incremental threshold parameter into one for small heaps and one for large. What counts as large and small are controlled by the existing parameters that were previously used for dynamic heap growth. I also renamed the parameter from "non-incremental threshold" to "incremental limit".

The small heap parameter is increased to 1.4. This avoids non-incremental GC on facebook and reddit as reported in the dependent bugs and allows us to remove the splay latency hack that was previously necessary.

Depends on D72902

Pushed by jcoppeard@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/97e38158d19c
Use doubles rather than floats for GC parameters r=sfink
https://hg.mozilla.org/integration/autoland/rev/0f48143464cc
Calculate non-incremental threshold based on heap size and increase it for smaller heaps r=sfink
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla77
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: