Open
Bug 1352524
(GCScheduling)
Opened 8 years ago
Updated 2 years ago
[meta] Improve GC scheduling
Categories
(Core :: JavaScript: GC, enhancement, P3)
Tracking
()
NEW
Performance Impact | low |
People
(Reporter: djvj, Unassigned)
References
(Depends on 30 open bugs, Blocks 2 open bugs)
Details
(Keywords: meta, perf)
This bug has been created after investigations and discussion with several people.
Garbage collection spans both the spidermonkey engine as well as gecko. There is very little in the way of central decision making.
For example, we unconditionally schedule a full GC once every minute. Spidermonkey independently schedules GC when under malloc pressure. And various other garbage collections are scheduled heuristically (e.g. GC after tab close).
These decisions need to be made centrally, taking into account all inputs, including:
1. Recentness of user activity
2. Whether we have recently spent a long time in JS (i.e. jank)
3. Whether the user just initiated an activity that requires smooth UI (don't GC in the middle of that).
4. Malloc pressure
5. System memory availability
6. Estimated next time that a particular event queue will become active (estimate using timeout events).
Reporter | ||
Comment 1•8 years ago
|
||
This bug _may_ subsume some of the other bugs under the QFGC meta bug 1351769 (e.g. the per-minute full GC invocation in bug 1351781).
Reporter | ||
Comment 2•8 years ago
|
||
I suggest a general plan of action:
1. A quick but complete survey of all the places in the codebase where a GC can get invoked, and an understanding of how that invocation could occur (i.e. what user actions or browser circumstance leads to the invocation), and an understanding of the kinds of GCs that can be invoked at those locations.
2. Characterize the issue that each of those is trying to address (i.e. why does that location feel a need to do a GC at that time, and what's the expected positive outcome?)
3. For each of those "gc motivations", figure out what inputs need to feed into the decision on when and if to invoke a GC, and if so what kind.
4. Collect all of these together and build a model that explain: what inputs are coming in to the scheduler, and how the scheduler uses those inputs to make scheduling decisions that speak to the motivations described in point 3.
Comment 3•8 years ago
|
||
CC Servo people
Comment 4•8 years ago
|
||
One thing to remember is that we used to take user activity into account more, but that was bad heuristic, so it got removed.
Though, that was during the single process FF era.
Updated•8 years ago
|
Whiteboard: [qf]
Updated•8 years ago
|
Whiteboard: [qf] → [qf:p1]
Comment 5•8 years ago
|
||
This will have to decide both when to trigger a new incremental GC, and when to schedule the next slice of an ongoing incremental GC.
Also, I think cycle collection will need to be scheduled from the same mechanism to have a coordinated system.
Comment 6•8 years ago
|
||
(In reply to Jon Coppeard (:jonco) from comment #5)
> Also, I think cycle collection will need to be scheduled from the same
> mechanism to have a coordinated system.
Yes, this is definitely true. We can't run IGC and ICC at the same time, so if we decide to run one when the other is already in progress then we have to sync finish it, which is bad.
It will also need to decide how long a slice is. Ideally, we would make slices longer if we are falling behind, again to prevent a sync finishing off of the collection.
Comment 7•8 years ago
|
||
Taking bug, since I'm looking into this.
Currently I'm looking into first creating timing for the XPCOM event loop re-entry. The situation is a little complicated since there seem to be multiple points that should be considered "the event loop". If that timing information is then passed on to the GC, it could use that timing information to make a decision, even without a "scheduler".
As far as a "scheduler", it would probably be implemented as an Event that gets scheduled normally, but then determines whether or not to actually take action at the point of running.
Assignee: nobody → sstangl
Comment 8•7 years ago
|
||
FWIW, I'm also looking at to use idle time for CC and GC timers which nsJSEnvironment has.
Updated•7 years ago
|
Whiteboard: [qf:p1] → [qf:p2]
Updated•7 years ago
|
Whiteboard: [qf:p2] → [qf:p3]
Updated•7 years ago
|
Priority: -- → P3
Updated•6 years ago
|
Keywords: meta
Summary: Implement a GC scheduler → [meta] Improve GC scheduling
Updated•6 years ago
|
Alias: GCScheduling
Updated•6 years ago
|
Updated•6 years ago
|
Assignee: sstangl → jcoppeard
Updated•6 years ago
|
Updated•3 years ago
|
Assignee: jcoppeard → nobody
Updated•3 years ago
|
Updated•3 years ago
|
Performance Impact: --- → P3
Whiteboard: [qf:p3]
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•