-
Notifications
You must be signed in to change notification settings - Fork 18k
runtime: allow users to opt into 4MB arenas #42612
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
Comments
Change https://golang.org/cl/269998 mentions this issue: |
I don't think a build tag (or any optional behavior) is the right way to resolve running up against strict overcommit. It's another configuration to maintain. I think we should consider doing a 64 MiB reservation ( Such a change does mean we can retain the performance benefits of having a shallower arena index on 64-bit platforms (1-2%), but where we lose is that we potentially have to do more syscalls. I personally don't think that's a big deal because heap growths are relatively rare whereas we access the arena index extremely often. Notably, we won't have to do more syscalls than on 4 MiB arena platforms since we also already round up It's a fairly small and easy change to make, though unfortunately I think at this point it will have to wait for Go 1.17, unless I'm wrong. @aclements WDYT? |
I agree that I don't want to ship a configuration flag for this. But I like @mknyszek's idea of using mheap.curArena to map the reservation more incrementally. This would also solve #28081 (see in particular #28081 (comment)). I think we have to be careful not to map it in too small of chunks just to reduce I think this is too late for 1.16, unfortunately, but since it should be a pretty simple change we could make it now and queue it up for 1.17. @mknyszek , care to do the honors? |
(Actually, we should definitely do it at least 2 MiB at a time so we don't break up huge pages on amd64.) |
Change https://golang.org/cl/270537 mentions this issue: |
@calder if it's not too much trouble, do you mind trying out https://golang.org/cl/270537 and seeing if it resolves issues with strict overcommit for you? |
Problem
Some embedded Linux platforms disable overcommit to reduce dynamic behavior in the system. Go already uses 4MB arenas on 32-bit platforms, but on 64-bit platforms the initial 64MB arena adds a steep cost to any Go binary.
Proposal
Allow users to opt into 4MB arenas at build time by passing
-tags force_small_arena
to the compiler.References
The text was updated successfully, but these errors were encountered: