Nightly doesnt use parallel threads on a 1.6s long GC Marking on a modified testcase (and spends 26s in Sweep phase)
Categories
(Core :: JavaScript Engine, task, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox146 | --- | fixed |
People
(Reporter: mayankleoboy1, Assigned: sfink)
References
(Blocks 1 open bug)
Details
Attachments
(3 files, 2 obsolete files)
Profile: Nightly: https://share.firefox.dev/4f8682E
Testcase is modified from the testcase in bug 1821107 (so I have no idea what I'm doing)
| Reporter | ||
Comment 1•1 year ago
|
||
And here is a profile where it appears to be using parallel thread: https://share.firefox.dev/3OO5qwI
Comment 2•1 year ago
|
||
This is doing weak map marking, which is not parallelised. However it is taking an extremely long time.
Most of the time is in Zone::enterWeakMarkingMode and looking at that it seems that we are not making progress but yielding to the mutator and restarting marking the ephemeron edges every time we exhaust the slice budget.
Steve, any ideas here? I think we need to restart in case the mutator added more entries to this table. Is that right? Maybe we could set a flag and run to completion if we previously yielded here. I don't see any obvious way to restart from where we left off.
| Assignee | ||
Comment 3•1 year ago
|
||
I have a set of changes that improve this test case.
- initially, it takes 3.6 us per entry (for 4M entries)
- turning the GC nonincremental if enterWMM blows the budget drops it to 1.5us
- reducing the memory usage of the gcEphemeronEdges table by using tagged pointers for the values has no effect on the time
- "optimizing" failed lookups by using a bit on the arena has no effect on the time, so I dropped the patch
- delaying tracing weakmaps' entries until everything reachable has been marked drops it to 0.9us
This last is a heuristic. It is good in this case because the order of marking happens to be WeakMap-first (because it's earlier in the code, roughly), which is the worst possible. This is not guaranteed to always work; you could have a whole bunch of objects that are only reachable through a WeakMap, and then you'd build up a giant ephemeron edge table again. But this at least makes it much less likely to fall into the problematic case, at the cost of an unfortunate amount of added complexity. (Because of lock ordering, the entry marking needs to be done on the main marking thread. Though it's possible that we could be dropping the helper thread state lock, and then that would no longer be the case?)
Another approach might be to add fine-grained locking around the ephemeron edge table. This would add some lock contention, but might simplify the code by allowing the (deferred) traceWeakEntries to happen on the parallel marking threads.
Updated•1 year ago
|
| Reporter | ||
Comment 4•1 year ago
•
|
||
For some reason, this testcase has become 2x slower now : https://share.firefox.dev/4krCBVJ (60s) . Profile in comment 0 took 30s
Edit: filed as bug 1954261
| Reporter | ||
Comment 5•10 months ago
|
||
maybe this is now higher priority because of https://bugzilla.mozilla.org/show_bug.cgi?id=1821107#c14 ?
| Assignee | ||
Comment 6•7 months ago
|
||
Updated•7 months ago
|
| Assignee | ||
Comment 7•7 months ago
|
||
| Assignee | ||
Comment 8•7 months ago
|
||
| Assignee | ||
Comment 9•7 months ago
|
||
Comment 10•7 months ago
|
||
Comment on attachment 9516310 [details]
Bug 1935829 - have GCMarker::{stop,reset} call a common GCMarker::postMarking() r=jonco
Revision D266264 was moved to bug 1991980. Setting attachment 9516310 [details] to obsolete.
Comment 11•7 months ago
|
||
Comment on attachment 9516312 [details]
Bug 1935829 - Reorder marking to delay tracing a WeakMap's entries until everything else has been marked r=jonco
Revision D266265 was moved to bug 1991980. Setting attachment 9516312 [details] to obsolete.
Comment 13•7 months ago
|
||
Comment 14•7 months ago
|
||
Comment 15•7 months ago
|
||
Backed out for causing SM bustages
- Backout link
- Push with failures
- Failure Log
- Failure line: /builds/worker/checkouts/gecko/js/src/gc/Sweeping.cpp:X:42: error: no member named 'progress' in 'JS::SliceBudget'
| Assignee | ||
Updated•7 months ago
|
Comment 16•7 months ago
|
||
Comment 17•7 months ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/54bbc45df480
https://hg.mozilla.org/mozilla-central/rev/5344d49a971e
| Reporter | ||
Comment 18•7 months ago
•
|
||
Edit:
there is some odd behaviour with the profiler and this testcase. I have filed bug 1994907 to track it separately.
Updated•6 months ago
|
Description
•