Cleanup and refactoring of GC system memory allocation functions
Categories
(Core :: JavaScript: GC, enhancement, P3)
Tracking
()
People
(Reporter: ehoogeveen, Assigned: ehoogeveen)
References
Details
Attachments
(3 files, 7 obsolete files)
45.71 KB,
patch
|
ehoogeveen
:
review+
|
Details | Diff | Splinter Review |
28.87 KB,
patch
|
ehoogeveen
:
review+
|
Details | Diff | Splinter Review |
25.85 KB,
patch
|
ehoogeveen
:
review+
|
Details | Diff | Splinter Review |
Assignee | ||
Comment 1•6 years ago
|
||
Assignee | ||
Comment 2•6 years ago
|
||
Comment 3•6 years ago
|
||
Comment 4•6 years ago
|
||
Comment 5•6 years ago
|
||
Assignee | ||
Comment 6•6 years ago
|
||
Updated•6 years ago
|
Comment 7•6 years ago
|
||
Updated•6 years ago
|
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Comment 8•6 years ago
|
||
Assignee | ||
Comment 9•6 years ago
|
||
Comment 10•6 years ago
|
||
Comment 11•6 years ago
|
||
Assignee | ||
Comment 12•6 years ago
|
||
Assignee | ||
Comment 13•6 years ago
|
||
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Comment 14•6 years ago
|
||
Comment 15•6 years ago
|
||
Assignee | ||
Comment 16•6 years ago
|
||
Assignee | ||
Comment 18•6 years ago
|
||
Comment 19•6 years ago
|
||
Comment 20•6 years ago
|
||
Comment 21•6 years ago
|
||
Assignee | ||
Comment 22•6 years ago
|
||
Assignee | ||
Comment 23•6 years ago
|
||
Assignee | ||
Comment 24•6 years ago
|
||
Assignee | ||
Comment 25•6 years ago
|
||
Assignee | ||
Comment 26•6 years ago
|
||
Assignee | ||
Comment 27•6 years ago
|
||
Assignee | ||
Comment 28•6 years ago
|
||
Assignee | ||
Comment 29•6 years ago
|
||
Assignee | ||
Comment 30•6 years ago
|
||
Assignee | ||
Comment 31•6 years ago
|
||
Comment 32•6 years ago
|
||
Comment 33•6 years ago
|
||
Assignee | ||
Comment 34•6 years ago
|
||
Assignee | ||
Comment 35•6 years ago
|
||
Comment 36•6 years ago
|
||
Data point: Fedora Core 28 Server (!) configured for the SoftIron Overdrive 1000:
CONFIG_ARM64_PAGE_SHIFT=12
CONFIG_ARM64_CONT_SHIFT=4
CONFIG_ARM64_4K_PAGES=y
# CONFIG_ARM64_16K_PAGES is not set
# CONFIG_ARM64_64K_PAGES is not set
# CONFIG_ARM64_VA_BITS_39 is not set
CONFIG_ARM64_VA_BITS_48=y
CONFIG_ARM64_VA_BITS=48
CONFIG_ARM64_PA_BITS_48=y
CONFIG_ARM64_PA_BITS=48
Since this is Server it is not surprising that it is configured with 48-bit virtual addresses, or at least that's what it looks like to me. (Fedora has no aarch64 support for Workstation from what I can tell.)
Assignee | ||
Comment 37•6 years ago
|
||
Carrying forward r+. This addresses all the comments except the one about #ifdef; I left that one for part 3.
Assignee | ||
Comment 38•6 years ago
|
||
I was torn on whether to make this its own part, but I think there's enough new here that you should at least have a look.
This patch disables the new allocator on platforms that don't have a very large address range. On these platforms the new allocator's scattershot approach causes problems when mixing very large allocations/reservations (like WASM's) with smaller allocations, and we're better off letting the OS tell us where to allocate.
On platforms where we do have a large enough address range to use the new allocator, I split the address range in half: the lower half is reserved for smaller allocations and the upper half is reserved for huge (>= 1GiB) allocations. This should keep regular chunk allocations from stepping on WASM's toes and vice versa.
Finally, if there's no chance of getting an invalid address we now fall back to overallocating (MapAlignedPagesSlow) before we give up in MapAlignedPagesRandom, and if the allocation is a huge reservation we return nullptr instead of crashing.
I also adjusted the tests and exposed some new helper functions. Since we now enable the older allocator again on some 64-bit platforms (but without the bad allocation loop) we can test it again, and WASM might be interested in knowing the system's address range.
Comment 39•6 years ago
|
||
Comment 40•6 years ago
|
||
(In reply to Steve Fink [:sfink] [:s:] from comment #39)
I wonder if there's a good place to expose this. getBuildConfiguration()
Sorry, s/this/some of these discovered values like address bits/.
Assignee | ||
Comment 41•6 years ago
|
||
GetOSConfiguration()? GetKernelConfiguration()? Well, right now it's still only a few values. That reminds me though, maybe it would be good to expose the allocation granularity (it doesn't hurt to pass an alignment smaller than the allocation granularity to MapAlignedPages(), but I could imagine something like a vector implementation wanting to know what the smallest sensible heap allocation is - assuming malloc isn't good enough).
Assignee | ||
Comment 42•6 years ago
|
||
Oh, and thanks for the review! Carrying forward r+, just added a big comment above MapAlignedPagesRandom() to explain the algorithm.
Build only try run to confirm I didn't break anything while splitting off part 3: https://treeherder.mozilla.org/#/jobs?repo=try&revision=9f7d8cab8c8847a2bc5ec11660a0933ef448f1ad
(I did a full run earlier and it was green modulo some m-c bustage)
Comment 44•6 years ago
|
||
Pushed by nbeleuzu@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/32aab5bf983a
Part 1: Clean up and refactor GC system memory allocation functions. r=sfink
https://hg.mozilla.org/integration/mozilla-inbound/rev/ac29aabfda36
Part 2: Allocate at randomly chosen aligned addresses on 64-bit platforms. r=sfink
https://hg.mozilla.org/integration/mozilla-inbound/rev/e5d3da4bdf58
Part 3: Tune new allocator to play nice with WASM. r=sfink
Comment 45•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/32aab5bf983a
https://hg.mozilla.org/mozilla-central/rev/ac29aabfda36
https://hg.mozilla.org/mozilla-central/rev/e5d3da4bdf58
Comment 46•6 years ago
|
||
65=wontfix because I assume we do not want to uplift GC changes to 65 Beta when there are only two weeks remaining in the release cycle.
Assignee | ||
Comment 47•6 years ago
|
||
(In reply to Chris Peterson [:cpeterson] from comment #46)
65=wontfix because I assume we do not want to uplift GC changes to 65 Beta when there are only two weeks remaining in the release cycle.
Yes, this is a pretty big change that I wouldn't land during the soft freeze, much less uplift.
Description
•