Closed
Bug 804891
Opened 12 years ago
Closed 12 years ago
Shrink memory usage by reduce default chunk size for analysis-temporary (LifoAlloc).
Categories
(Firefox OS Graveyard :: General, defect)
Tracking
(firefox18 fixed, firefox19 fixed)
RESOLVED
FIXED
People
(Reporter: sinker, Assigned: nnethercote)
References
Details
(Whiteboard: [MemShrink])
Attachments
(2 files, 1 obsolete file)
(deleted),
text/plain
|
Details | |
(deleted),
patch
|
billm
:
review+
akeybl
:
approval-mozilla-aurora+
|
Details | Diff | Splinter Review |
The default value of LIFO_ALLOC_PRIMARY_CHUNK_SIZE is too big (128K) that almost all compartments do not use it up. It wastes a lot of memory (~10%). By cutting down LIFO_ALLOC_PRIMARY_CHUNK_SIZE for compartments, it can save a lot of memory. By setting LIFO_ALLOC_PRIMARY_CHUNK_SIZE to 32K, the memory size for analysis-temporary comes down to 1.8MB from original ~5MB.
Comment 1•12 years ago
|
||
The tradeoff here is that smaller chunks cause longer GC pauses, but maybe that is only a real problem on OSX. Pretty amazing that it is using up that much memory though!
Reporter | ||
Comment 2•12 years ago
|
||
Updated•12 years ago
|
Whiteboard: [MemShrink]
Reporter | ||
Comment 3•12 years ago
|
||
Attachment #674518 -
Attachment is obsolete: true
Reporter | ||
Comment 4•12 years ago
|
||
75% of compartments do not use more than 32K for analysis-temporary.
Comment 5•12 years ago
|
||
Good catch, Thinker!
The size was set to 128 KiB in bug 699668 after lots of discussion. However, that was before compartment-per-global. (Indeed, see the last sentence in bug 699668 comment 26.) 32 KiB seems a good starting point for re-evaluation.
billm, are you able to do some experiments like the ones you did in bug 699668 comment 25 to determine if 32 KiB is reasonable, and whether 16 KiB would be ok?
Depends on: 764220
Updated•12 years ago
|
Comment 6•12 years ago
|
||
We may incrementally discard these structures now, come to think of it.
Yes, we free this stuff on the background thread now. So I think 16K should be fine.
Comment 8•12 years ago
|
||
> Yes, we free this stuff on the background thread now. So I think 16K should
> be fine.
Great! Do you want to do experiments before landing a change?
Nice! :)
Comment 10•12 years ago
|
||
I talked to billm. The original problem with all this was that free() is really slow on Mac. But because of the background freeing he thinks it shouldn't be a problem anymore.
Nonetheless, he'd like to land a patch for this on mozilla-central, and then wait a week to see what the telemetry data looks like. Assuming it doesn't cause problems, we can then backport it to Aurora.
Comment 11•12 years ago
|
||
I compared 128, 32 and 16 KiB arenas on Mac64 desktop. My process:
1. start browser, open about:memory, get measurement
2. hit "minimize memory usage", get measurement
3. open techcrunch.com in a second tab, hit "update" in about:memory, get
measurement
4. hit "minimize memory usage", get measurement
Results:
128 KiB arenas range
-------------- -----
1. 8.5 6.6 19.6 19.6 19.6 6.6--19.6
2. 0.4 0.4 0.4 0.4 0.4 0.4
3. 3.4 3.4 10.4 15.2 2.2 2.2--15.2
4. 2.0 1.9 1.8 1.8 2.3 1.8-- 2.3
32 KiB arenas range
------------- -----
1. 4.8 4.0 11.4 11.5 11.5 4.0--11.5
2. 0.2 0.2 0.2 0.2 0.2 0.2
3. 1.2 1.4 4.8 4.4 4.5 1.2--4.8
4. 0.6 0.6 0.6 0.7 0.5 0.5--0.7
16 KiB arenas range
------------- -----
1. 4.3 3.8 10.7 10.7 10.7 3.8--10.7
2. 0.2 0.2 0.2 0.2 0.2 0.2
3. 3.7 0.9 4.7 1.8 2.4 0.9--4.7
4. 0.4 0.4 0.4 0.5 0.4 0.4-- 0.5
The improvement between 32 and 16 is small enough that I suggest we change it to 32, to minimize the chance of GC time regressions.
Comment 12•12 years ago
|
||
Shrink it from 128 KiB to 32 KiB.
Attachment #674842 -
Flags: review?(wmccloskey)
Comment 13•12 years ago
|
||
> 128 KiB arenas range
> -------------- -----
> 1. 8.5 6.6 19.6 19.6 19.6 6.6--19.6
> 2. 0.4 0.4 0.4 0.4 0.4 0.4
> 3. 3.4 3.4 10.4 15.2 2.2 2.2--15.2
> 4. 2.0 1.9 1.8 1.8 2.3 1.8-- 2.3
I failed to mention that measurements 1 and 3 are volatile, which is why I did all the measurements five times.
Attachment #674842 -
Flags: review?(wmccloskey) → review+
Comment 14•12 years ago
|
||
Comment 15•12 years ago
|
||
Assignee: nobody → nnethercote
Status: NEW → RESOLVED
Closed: 12 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
\o/
Comment 17•12 years ago
|
||
Setting flags so we hopefully don't forget to uplift this one.
status-firefox18:
--- → affected
Whiteboard: [MemShrink] → [MemShrink][waiting-for-telemetry-before-uplifting-to-aurora]
Comment 18•12 years ago
|
||
billm, can you look at the telemetry to see if any bad effects have occurred? Thanks.
It looks good to me. I think it's ready for aurora.
Updated•12 years ago
|
Whiteboard: [MemShrink][waiting-for-telemetry-before-uplifting-to-aurora] → [MemShrink][aurora-checkin-needed]
Comment 20•12 years ago
|
||
This needs either blocking-basecamp or aurora approval, as far as I understand.
Comment 21•12 years ago
|
||
Comment on attachment 674842 [details] [diff] [review]
patch
[Approval Request Comment]
Bug caused by (feature/regressing bug #): N/A.
User impact if declined: higher memory usage, esp. on B2G.
Testing completed (on m-c, etc.): has been on m-c for several days without problem; billm has checked telemetry data to confirm that an unlikely-but-possible GC time regression didn't occur.
Risk to taking this patch (and alternatives if risky): negligible. The patch changes a single constant that controls the size of chunks of memory used for type inference analysis.
String or UUID changes made by this patch: none.
Attachment #674842 -
Flags: approval-mozilla-aurora?
Updated•12 years ago
|
Whiteboard: [MemShrink][aurora-checkin-needed] → [MemShrink]
Comment 22•12 years ago
|
||
Comment on attachment 674842 [details] [diff] [review]
patch
[Triage Comment]
Thanks for looking into whether or not this caused a new performance regression for desktop. Given that analysis, and the risk evaluation here, approving for Aurora 18.
Attachment #674842 -
Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Comment 23•12 years ago
|
||
status-firefox19:
--- → fixed
Comment 24•12 years ago
|
||
This was backed out while investigating Android timeouts and re-landed after it was deemed not at fault.
https://hg.mozilla.org/releases/mozilla-aurora/rev/50cee6bb0eea
You need to log in
before you can comment on or make changes to this bug.
Description
•