Closed
Bug 1093307
Opened 11 years ago
Closed 11 years ago
OOM calls ShrinkGCBuffers, but ShrinkGCBuffers does its work off-main-thread
Categories
(Core :: JavaScript: GC, defect)
Core
JavaScript: GC
Tracking
()
RESOLVED
FIXED
mozilla36
People
(Reporter: terrence, Assigned: terrence)
References
(Blocks 1 open bug)
Details
(Whiteboard: [MemShrink:P2])
Attachments
(3 files)
|
2.58 KB,
patch
|
jonco
:
review+
|
Details | Diff | Splinter Review |
|
3.20 KB,
patch
|
jonco
:
review+
|
Details | Diff | Splinter Review |
|
5.44 KB,
patch
|
jonco
:
review+
|
Details | Diff | Splinter Review |
ShrinkGCBuffers is an API called by gecko occasionally to do decommit: this happens off-main-thread and does not block, so effectively has no effect on the main thread. However, the OOM path in JSRuntime is trying to use it to free memory before re-allocating. We need a new API here that works on the main thread to synchronously toss everything that isn't nailed down.
Updated•11 years ago
|
Whiteboard: [MemShrink]
| Assignee | ||
Comment 1•11 years ago
|
||
Ah, actually looks like onOOM calls waitForBackgroundSweepOrAllocEnd -- didn't know that was public(!) -- so it's not actually totally busted. Still there's a ton more stuff we could be tossing here.
| Assignee | ||
Comment 2•11 years ago
|
||
There is more to do here. In particular we should not have to do racy tricks with the bg thread, or involve another thread at all here. This is an acceptable first step though.
Attachment #8516802 -
Flags: review?(jcoppeard)
| Assignee | ||
Comment 3•11 years ago
|
||
And it looks like there's another serious facepalm with the shrinking GCs we trigger from the browser's low-memory signal. We currently do a full, non-incremental GC, then return to the mutator and sweep everything on the background thread. Of course, this means we'll only ever finish this work and actually free up memory far later, probably long after the browser has OOM'ed.
Attachment #8516851 -
Flags: review?(jcoppeard)
Updated•11 years ago
|
Attachment #8516802 -
Flags: review?(jcoppeard) → review+
Comment 4•11 years ago
|
||
Comment on attachment 8516851 [details] [diff] [review]
1_shrink_harder-v0.diff
Review of attachment 8516851 [details] [diff] [review]:
-----------------------------------------------------------------
This is ok but we may need to change this again if we want to enable incremental compacting GC.
::: js/src/jsgc.cpp
@@ +5024,5 @@
>
> + sweepOnBackgroundThread = !lastGC &&
> + !TraceEnabled() &&
> + CanUseExtraThreads() &&
> + !shouldCompact() &&
shouldCompact() will return turn only if invocationKind == GC_SHRINK so this line is unnecessary with this change.
Attachment #8516851 -
Flags: review?(jcoppeard) → review+
| Assignee | ||
Comment 5•11 years ago
|
||
| Assignee | ||
Comment 6•11 years ago
|
||
This probably also wants to do unconditional decommit on the foreground.
Keywords: leave-open
| Assignee | ||
Comment 7•11 years ago
|
||
This adds a trivial decommit loop for use by the OOM path so that we don't have to rely on the expireChunksAndArenas viper-pit. This also unlocks a nice follow-up: now if we want to use a Vector to pass chunks to do background decommit, we can can fall back to this path on OOM to do the decommit in the foreground.
Attachment #8517724 -
Flags: review?(jcoppeard)
Updated•11 years ago
|
Attachment #8517724 -
Flags: review?(jcoppeard) → review+
Comment 8•11 years ago
|
||
| Assignee | ||
Comment 9•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/6a96e15c810c
I feel much better about this path now.
Keywords: leave-open
Updated•11 years ago
|
Whiteboard: [MemShrink] → [MemShrink:P2]
| Assignee | ||
Comment 11•11 years ago
|
||
The build error was fixed in the other bug, so I think this should be fine now.
https://hg.mozilla.org/integration/mozilla-inbound/rev/d2603e86d422
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla36
You need to log in
before you can comment on or make changes to this bug.
Description
•