Summary: | WebAssembly: recycle fast memories more better | ||
---|---|---|---|
Product: | WebKit | Reporter: | JF Bastien <jfbastien> |
Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW --- | ||
Severity: | Normal | CC: | clopez, fpizlo, ggaren, jfbastien, keith_miller, mark.lam, msaboff, saam |
Priority: | P2 | ||
Version: | WebKit Nightly Build | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
See Also: |
https://bugs.webkit.org/show_bug.cgi?id=163600 https://bugs.webkit.org/show_bug.cgi?id=175150 |
||
Bug Depends on: | |||
Bug Blocks: | 159775 |
Description
JF Bastien
2017-03-31 09:11:17 PDT
For large allocations that need zero-backing, we generally prefer MADV_FREE_REUSABLE with explicit zeroing because it avoids the (very large) cost of page faults.
JF pointed out that Emscripten doesn't support grow-on-demand heaps, so lots of WASM programs demand very large heaps that they don't use. If that's true, WASM may be an exception to our general strategy, and it may benefit from MADV_ZERO_WIRED_PAGES or some other madvise/mmap API that forces on-demand page-fault-and-zero-fill behavior, since the memory cost of huge overcommits may be too high.
> 5. We could return the fast memories if we GC a few times and never reuse them, or if we get a "low-memory" signal from the system.
There's no point to unmapping cached fast memories in response to low memory warnings because they don't hold any physical pages.
|