Closed Bug 2055507 Opened 4 months ago Closed 2 months ago

Make mSpare a list of chunks

Categories

(Core :: Memory Allocator, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
157 Branch
Tracking Status
firefox157 --- fixed

People

(Reporter: pbone, Assigned: pbone)

References

(Blocks 3 open bugs, Regressed 1 open bug)

Details

(Keywords: perf-alert)

Attachments

(8 external files)

Making mSpare a list of chunks has three benefits.

  • I was experimenting with reducing the run header size which would make detecting empty runs trickier and the invariant that there's only ever one spare chunk would go away.
  • Part of Bug 2043962, on Windows the mSpare list becomes the entire chunk cache.
  • It allows us to release chunks during Purge time which is faster than sychronousoy with free().
Duplicate of this bug: 2043962

I have a series of patches. There's things missing:

  • Purge() is quite complex and I don't feel great about that. But we DO want the semantics of releasing entire chunks there.
  • The global cache should be disabled on Windows but not other OSs.
  • We need to double-check that low memory does ask mozjemalloc to purge, which will then release chunks.
  • "one weird trick" needs to be able to get chunks from other arenas (or just force them to flush).
Blocks: 2055564
No longer duplicate of this bug: 2043962
Assignee: nobody → pbone
Status: NEW → ASSIGNED
Blocks: 2057484
Attachment #9609671 - Attachment description: WIP: Bug 2055507 - pt 1. Make arena_t::mSpare a list → Bug 2055507 - pt 1. Make arena_t::mSpare a list r=glandium
Attachment #9609672 - Attachment description: WIP: Bug 2055507 - pt 2. Add DoublyLinkedList::isSingle() → Bug 2055507 - pt 2. Add DoublyLinkedList::isSingle() r=glandium
Attachment #9609673 - Attachment description: WIP: Bug 2055507 - pt 3. Making a chunk the spare no longer bumps the old spare → Bug 2055507 - pt 3. Making a chunk the spare no longer bumps the old spare r=glandium
Attachment #9609674 - Attachment description: WIP: Bug 2055507 - pt 4. Release spare chunks during purging → Bug 2055507 - pt 4. Release spare chunks during purging r=glandium
Attachment #9609675 - Attachment description: WIP: Bug 2055507 - pt 5. Don't release chunks during dealloc → Bug 2055507 - pt 5. Don't release chunks during dealloc r=glandium
Pushed by agoloman@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/551e89626c13 https://hg.mozilla.org/integration/autoland/rev/4e462235d000 Revert "Bug 2055507 - pt 7. Disable the chunk cache on Windows r=glandium" for causing sm bustages @expr-decompiler-bug1475953.js.

Backed out for causing sm bustages @expr-decompiler-bug1475953.js.

Flags: needinfo?(pbone)

This change means that:

  • a purging chunk is never the spare chunk,
  • a spare chunk is never purging.
  • RemoveChunk is never called on a spare chunk or a chunk in the
    mDirtyChunks list.
  • RemoveChunk is never called on a purging chunk and therefore can
    never fail.
  • Because RemoveChunk cannot fail the mDying flag and hand-off between
    purging and removing chunks can be removed.
  • After purging an empty chunk should always be demoted to spare
    (either because it became empty or it was empty and spare earlier).
  • Detection of empty chunks after purging has moved to
    FinishPurgingInChunk().

This patch deletes more lines than it inserts, and many of them are
comments or assertions. it makes other patches in this stack simpler
too!

Attachment #9631415 - Attachment description: Bug 2055507 - pt 0. Purging the spare chunk clears mSpare r=glandium → Bug 2055507 - pt 1. Purging the spare chunk clears mSpare r=glandium
Attachment #9609671 - Attachment description: Bug 2055507 - pt 1. Make arena_t::mSpare a list r=glandium → Bug 2055507 - pt 2. Make arena_t::mSpare a list r=glandium
Attachment #9609672 - Attachment description: Bug 2055507 - pt 2. Add DoublyLinkedList::isSingle() r=glandium → Bug 2055507 - pt 3. Add DoublyLinkedList::isSingle() r=glandium
Attachment #9609673 - Attachment description: Bug 2055507 - pt 3. Making a chunk the spare no longer bumps the old spare r=glandium → Bug 2055507 - pt 4. Making a chunk the spare no longer bumps the old spare r=glandium
Attachment #9609674 - Attachment description: Bug 2055507 - pt 4. Release spare chunks during purging r=glandium → Bug 2055507 - pt 5. Release spare chunks during purging r=glandium
Attachment #9609675 - Attachment description: Bug 2055507 - pt 5. Don't release chunks during dealloc r=glandium → Bug 2055507 - pt 6. Don't release chunks during dealloc r=glandium
Attachment #9615611 - Attachment description: Bug 2055507 - pt 6. Make the chunk cache a C++ class r=glandium → Bug 2055507 - pt 7. Make the chunk cache a C++ class r=glandium
Attachment #9615612 - Attachment description: Bug 2055507 - pt 7. Disable the chunk cache on Windows r=glandium → Bug 2055507 - pt 8. Disable the chunk cache on Windows r=glandium
Flags: needinfo?(pbone)

Perfherder has detected a browsertime performance change from push d04c97347dcc984bc6a4d49fa0933411f715727b.

No action is required from the author; this comment is provided for informational purposes only.

Improvements Test Platform Options Absolute values [old vs new] Performance Profiles
21% ve-av1-q-i420 wallclock-for-tracking-only (doc) linux2404-64-nightlyasrelease fission webrender 8,696.12 ms -> 6,858.90 ms Before/After
7% addkARN time_duration (doc) linux2404-64-shippable fission webrender 44,400.93 ms -> 41,485.86 ms Before/After
6% ve-av1-q-cam av01.0.04M.08 camera quality encode - first encode to last output (doc) macosx1470-64 fission webrender 4,613.71 ms -> 4,330.12 ms Before/After
6% ve-av1-q-cam (doc) macosx1470-64 fission webrender 4,613.71 score -> 4,330.12 score Before/After
5% ve-av1-q-i420 av01.0.04M.08 I420 canvas quality encode - first encode to last output (doc) windows11-64-24h2-shippable fission webrender 4,540.61 ms -> 4,319.40 ms Before/After
... ... ... ... ... ...
3% speedometer3 TodoMVC-JavaScript-ES6-Webpack-Complex-DOM/total (doc) linux2404-64-nightlyasrelease fission webrender 63.69 ms -> 61.64 ms Before/After

Need Help or Information?

If you have any questions, please reach out to fbilt@mozilla.com. Alternatively, you can find help on Slack by joining #perf-help, and on Matrix you can find help by joining #perftest.

Details of the alert can be found in the alert summary, including links to graphs and comparisons for each of the affected tests.

Keywords: perf-alert

Perfherder has detected a talos performance change from push d04c97347dcc984bc6a4d49fa0933411f715727b.

No action is required from the author; this comment is provided for informational purposes only.

Improvements Test Platform Options Absolute values [old vs new]
36% perf_reftest_singletons inline-style-cache-1.html (doc) linux2404-64-shippable e10s fission stylo webrender 297.02 ms -> 190.49 ms
33% perf_reftest_singletons inline-style-cache-1.html (doc) macosx1470-64-shippable e10s fission stylo webrender 329.02 ms -> 221.69 ms
22% perf_reftest_singletons inline-style-cache-1.html (doc) windows11-64-24h2-shippable e10s fission stylo webrender 178.50 ms -> 140.11 ms
16% pdfpaint issue6165.pdf (doc) macosx1470-64-shippable e10s fission stylo webrender-sw 767.04 ms -> 641.87 ms
12% pdfpaint issue6165.pdf (doc) linux2404-64-shippable e10s fission stylo webrender-sw 735.99 ms -> 647.02 ms
... ... ... ... ...
5% perf_reftest_singletons overflow-changed-tracker-1.html?n=20000 (doc) macosx1470-64-shippable e10s fission stylo webrender 235.03 ms -> 222.98 ms

Need Help or Information?

If you have any questions, please reach out to afinder@mozilla.com. Alternatively, you can find help on Slack by joining #perf-help, and on Matrix you can find help by joining #perftest.

Details of the alert can be found in the alert summary, including links to graphs and comparisons for each of the affected tests.

Regressions: 2070617
Regressions: 2070821
QA Whiteboard: [qa-triage-done-c158/b157]
Regressions: 2072456
See Also: → 2075855
Regressions: 2084968
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: