Closed Bug 820378 Opened 13 years ago Closed 13 years ago

Try to postpone triggering CC if we're in middle of GC handling

Categories

(Core :: DOM: Core & HTML, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla21
Tracking Status
firefox19 + fixed
firefox20 + fixed
firefox21 --- fixed

People

(Reporter: smaug, Assigned: smaug)

References

Details

(Keywords: regression, Whiteboard: [Snappy])

Attachments

(1 file, 9 obsolete files)

Attached patch WIP (obsolete) — — Splinter Review
Right now it is too easy to run CC very soon after GC. Also, if there is already incrementalgctimer, why should we start gctimer?
Shouldn't regress bug 730853, but may make some of the changes of that and of bug 758034 somewhat redundant.
But in general we should try to avoid the cases when GC and CC handling overlap. If CCtimer is running while we are doing incremental GC, CC's black bit propagation is less than optimal and eventually we just may have to force GC in order to run CC.
Attached patch WIP2 (obsolete) — — Splinter Review
Attachment #690869 - Attachment is obsolete: true
I'm little worried that the patch is too strict.
Attached patch WIP3 (obsolete) — — Splinter Review
Attachment #690872 - Attachment is obsolete: true
So the patch should make it less likely to run CC very soon after GC. That gives more time for forgetSkippable to optimize things out. (GC soon after CC shouldn't be a problem)
Cool, this looks like bug 811587. I'll take a look tomorrow.
Flags: needinfo?(wmccloskey)
Comment on attachment 690999 [details] [diff] [review] WIP3 Assuming the GC assertion is fixed, what do you think of this?
Attachment #690999 - Flags: review?(continuation)
Comment on attachment 690999 [details] [diff] [review] WIP3 Review of attachment 690999 [details] [diff] [review]: ----------------------------------------------------------------- Bill may want to look at this, as it is going to mean we delay triggering the GC from a timer. ::: dom/base/nsJSEnvironment.cpp @@ +3087,5 @@ > > // If we collected a substantial amount of cycles, poke the GC since more objects > // might be unreachable now. > if (sCCollectedWaitingForGC > 250) { > + // Try to start running GC reasonable soon after CC, so that reasonable -> reasonably @@ +3247,5 @@ > PRTime now = PR_Now(); > if (sCCLockedOutTime == 0) { > + // Reset sCCTimerFireCount so that we end up running forgetSkippable > + // often enough before CC. Because of reduced ccDelay > + // forgetSkippable will be called just few times. just -> just a @@ +3551,5 @@ > nsJSContext::KillInterSliceGCTimer(); > > sCCollectedWaitingForGC = 0; > sCleanupsSinceLastGC = 0; > + sNeedsFullCC = !aDesc.isCompartment; Why do you change this to only trigger a CC after a full GC?
Attachment #690999 - Flags: review?(continuation)
Attachment #690999 - Flags: review+
Attachment #690999 - Flags: feedback?(wmccloskey)
(In reply to Andrew McCreight [:mccr8] from comment #11) > @@ +3551,5 @@ > > nsJSContext::KillInterSliceGCTimer(); > > > > sCCollectedWaitingForGC = 0; > > sCleanupsSinceLastGC = 0; > > + sNeedsFullCC = !aDesc.isCompartment; > > Why do you change this to only trigger a CC after a full GC? Well, we do still trigger CC timer if there is enough stuff to collect But in certain JS heavy pages we get often compartment GCs. In such cases we often don't need to run CC timer so often. Just run CC after such GC which has ended up causing lots of suspected objects.
(In reply to Andrew McCreight [:mccr8] from comment #11) > Bill may want to look at this, as it is going to mean we delay triggering > the GC from a timer. Sure, but JS_MaybeGC does still get called, so we may end up running GC while there is CC timer running if there really is something to collect.
I'm seeing actually quite bad behavior too often. We should consider fixing this even for FF19. I don't know what has regressed this.
This should help with max GC times too, since iGC doesn't need to be interrupted by CC so often. I'm currently using a build with the patch, and initial results look good.
Olli, I posted a patch to fix the assertion in bug 811587.
Flags: needinfo?(wmccloskey)
I wonder if the patch is a bit too strict. Perhaps GC should get better chances to run.
Attached patch More like GCs after CC (obsolete) — — Splinter Review
Attachment #690999 - Attachment is obsolete: true
Attachment #690999 - Flags: feedback?(wmccloskey)
Attachment #692678 - Flags: review?(wmccloskey)
Yeah, that patch seems to work better. We do still call GC often enough, but not so that CC runs too soon after GC.
Bah, need still one tweak
or maybe not. I'd be ok to try the attached patch.
Attached patch wip3 (obsolete) — — Splinter Review
Or let's try this after all. If we try to start gc while we have cc timer running, make sure to start gc timer after cc timer.
Attachment #692678 - Attachment is obsolete: true
Attachment #692678 - Flags: review?(wmccloskey)
https://tbpl.mozilla.org/?tree=Try&rev=1a9737afeb79 for tryserver builds. These patches are a bit slow to test. Takes a day or so to see the behavior in various situations.
Attachment #692801 - Flags: review?(wmccloskey)
So far the patch has been working the way I want. Posted the GC assertion fix + the patch in this bug to try https://tbpl.mozilla.org/?tree=Try&rev=31246cd0c014
Argh, that setup leaks on windows.
Tracking for now, would be great to find out what regressed this so we can look at our options here for Aurora (19).
Comment on attachment 692801 [details] [diff] [review] wip3 Review of attachment 692801 [details] [diff] [review]: ----------------------------------------------------------------- Looks good to me. ::: dom/base/nsJSEnvironment.cpp @@ +3159,5 @@ > > // If we collected a substantial amount of cycles, poke the GC since more objects > // might be unreachable now. > if (sCCollectedWaitingForGC > 250) { > + // Try to start running GC reasonable soon after CC, so that reasonably soon. Also, there's no need for the comma.
Attachment #692801 - Flags: review?(wmccloskey) → review+
Attached patch v4 (obsolete) — — Splinter Review
Trying to figure out the Win debug leak https://tbpl.mozilla.org/?tree=Try&rev=0c6a8c156582
Attached patch v5 (obsolete) — — Splinter Review
like v5, but makes sure we exit forgetSkippable timer sooner if we're expecting to run GC soon.
Attachment #693896 - Attachment is obsolete: true
Attached patch v5 (obsolete) — — Splinter Review
Attachment #694850 - Attachment is obsolete: true
Depends on: 817354
Whiteboard: [Snappy]
Attached patch simple (obsolete) — — Splinter Review
Since nothing has quite worked yet, perhaps this kind of super simple approach could be enough for most common cases. https://tbpl.mozilla.org/?tree=Try&rev=a920a6fdcfb1
Comment on attachment 698847 [details] [diff] [review] simple Assuming this passes on try, I could push tomorrow "morning" EET. This is a tiny part of the already reviewed patch.
Attachment #698847 - Flags: review?(continuation)
Comment on attachment 698847 [details] [diff] [review] simple Review of attachment 698847 [details] [diff] [review]: ----------------------------------------------------------------- That makes a lot of sense. I did a little bit of local testing, and this patch did eliminate all sync forget skippables. ::: dom/base/nsJSEnvironment.cpp @@ +3307,5 @@ > ccDelay = NS_CC_DELAY / 3; > > PRTime now = PR_Now(); > if (sCCLockedOutTime == 0) { > + // Reset sCCTimerFireCount so that we end up running forgetSkippable "we end up running" can probably be "we run" @@ +3309,5 @@ > PRTime now = PR_Now(); > if (sCCLockedOutTime == 0) { > + // Reset sCCTimerFireCount so that we end up running forgetSkippable > + // often enough before CC. Because of reduced ccDelay > + // forgetSkippable will be called just few times. "just few" -> "just a few"
Attachment #698847 - Flags: review?(continuation) → review+
Attached patch patch — — Splinter Review
Let's try other improvements in some other bug
Attachment #692801 - Attachment is obsolete: true
Attachment #694851 - Attachment is obsolete: true
Attachment #698847 - Attachment is obsolete: true
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Comment on attachment 699088 [details] [diff] [review] patch I think this might be good for branches, at least for Aurora. [Approval Request Comment] Bug caused by (feature/regressing bug #): kind of bug 730853, but iGC wasn't enabled at that time, I think User impact if declined: higher pause times when CC runs Testing completed (on m-c, etc.): landed to m-c Risk to taking this patch (and alternatives if risky): should be reasonable safe String or UUID changes made by this patch: NA
Attachment #699088 - Flags: approval-mozilla-beta?
Attachment #699088 - Flags: approval-mozilla-aurora?
Seems to be effective change. Reduces risk for higher than needed pauses when running CC. And should be safe for branches, even for beta.
Based on telemetry this was very effective.
Comment on attachment 699088 [details] [diff] [review] patch Considering comment#36,37,38 & where we are in the cycle approving on aurora/beta.We will be going to build with beta# 2 on Tuesday , which will include this patch giving us 4-5 weeks of testing before release.
Attachment #699088 - Flags: approval-mozilla-beta?
Attachment #699088 - Flags: approval-mozilla-beta+
Attachment #699088 - Flags: approval-mozilla-aurora?
Attachment #699088 - Flags: approval-mozilla-aurora+
Target Milestone: --- → mozilla21
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: