-
Notifications
You must be signed in to change notification settings - Fork 694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move dont_need
into MVP?
#384
Comments
+1 |
sgtm |
One challenge for current asm.js implementations will be to ensure that the array buffer elements start aligned to a page boundary. I don't think any other alignment is useful and that app developers should be able to depend on this alignment. This was practical on Odin last time I looked, but I have not looking in this for v8 and jsc implementations? Could this alignment requirement be added to the wasm spec. |
Yes, this is vaguely implied in the current text by "The |
I can see this being harmless, but it seems like it's a member of a class On Fri, Oct 2, 2015 at 5:45 PM, Luke Wagner notifications@github.com
|
I think Now I was thinking that maybe memcpy allows exposing the underlying OS functionality to remap pages (e.g., |
If this boils down to a memset(0) with an additional performance hint, why Is this really a critical thing for MVP? Or, does shipping an MVP without On Fri, Oct 2, 2015 at 9:20 PM, Luke Wagner notifications@github.com
|
I think it's pretty critical to allow developers to reduce their memory footprint. In fact, it's unfortunate that array buffers are guaranteed to be committed physical pages, especially since many applications optimistically allocate too much. For memory constrained devices I think it's very useful to be able to avoid physical reservation. Agreed it's not fundamental (apps can work without it). It also seems easy to support, so I like this proposal. |
@titzer We may not be able to specify the effects of this operation on RSS, but I think it's more than a "hint": the implied implementation is nothing more than call to |
So I might be in the minority here, but I think we should avoid some We also want to have a nice train of releases and updates, so maybe this On Fri, Oct 2, 2015 at 10:15 PM, JF Bastien notifications@github.com
|
@titzer Definitely agreed on the goal of minimality of MVP, but this seemed like that it was in the sweet spot of being both trivial to implement/specify and known necessary/useful. Trivial or not, I know at some point we need to just arbitrarily draw the line and say "catch the next train"; but it wasn't clear to me that we're at that point yet. I don't have a strong opinion on this matter, though. |
@lukewagner The requirement for the addr and length parameter to be a multiple of the page size does not help if the implementation does not align the start of the buffer elements to a physics page. This does make a real difference for the application, and could this requirement also be added to the spec. |
@JSStats An implementation would align its buffer at some page boundary and, even if it didn't, an implementation could still do a good job by |
@lukewagner It does affect the application in practice. If this alignment could not be guaranteed then an application could not depend on using dont_need on a page-by-page basis, rather would have to try and merge requests hoping that the runtime can free some of them. Not specifying this would have unintended negative consequences. Also not including dont_need in the MVP might have the unintended consequence of implementations trying to free pages in memset calls. Someone might just have to add support for v8 and jsc too to get this in if they are not particularly interested. |
@lukewagner Just curious: is a |
@JSStats Again, implementations are just going to page-align; with wasm, the linear memory is created when the module is loaded as part of the instance so it's much easier than the situation with ArrayBuffers.
Yes; iiuc, |
It sounds like on Windows there no real benefit to the |
@MikeHolman The benefit is removing physical pages from the working set while keeping the virtual address range committed. See the description of |
You're right that it doesn't make the pages resident, but committed pages consume "commit charge" (i.e. page file space) even if they don't consume physical pages. I'm not sure if there's an analogous state to "reserved but not committed" on POSIX systems. I think Windows also allocates page tables for any committed pages, but not for pages that are only reserved. |
Another issue might be that |
Lack of atomicity is indeed a huge issue. We need to make sure this can be done atomically on Windows. It seems like Alignment is an unrelated issue IMO, we should discuss elsewhere. Page table entries are necessarily consumed, but that's not a true issue: it doesn't consume physical pages (which is what matters on low-memory devices), and the TLB hides the cost of traversing the PTEs. Anyhow, I'm OK will making this:
We definitely want this, but I'm OK if we get it soon enough. |
I think exposing this as a page-sized |
@jfbastien Yeah, even if this is pretty trivial to add (no atomicity issue before threads), I'm fine waiting too. I was even thinking that having a batch of low-hanging post-v.1 fruit (much easier than "dynamic linking" and "threads") might help ease the transition into post-v.1 iteration. @AndrewScheidecker Sounds good to me; I guess POSIX would simulate that with |
On Mon, Oct 5, 2015 at 4:43 PM, Luke Wagner notifications@github.com
How about renaming "dont_need" to be more "verby", since it zeroes the
|
Not to veer into bikeshed, but does the verb 'discard' accurately capture what it implies? discard the contents of the page (zero it out) and discard the page/its backing store (decommit it if wanted) |
sgtm on both points |
Discard sgtm On Mon, Oct 5, 2015 at 8:46 PM, Luke Wagner notifications@github.com
|
Right, closing with the answer "no" and the two small changes captured in #388. |
Weighing costs/benefits, I was thinking there's little reason not to bump
dont_need
into the MVP: it's trivial to implement (if you don't want to do the implied sycall, you can just memzero), it'd be immediately used by the toolchain's malloc, and it would be immediately useful on mobile for reducing RSS and thus probability of oom-kill.The text was updated successfully, but these errors were encountered: