Skip to content
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

Allow carrier migration between different allocator types #1854

Conversation

Projects
None yet
1 participant
@jhogberg
Copy link
Contributor

commented Jun 29, 2018

Carriers can currently only move between instances of the same allocator type, which causes excessive memory allocation when one type is starved and another has lots of leftovers. This PR lifts that restriction and makes all allocator types share the same "carrier migration pool."

This is transparent aside from changes in how erlang:system_info({allocator, Alloc}) reports its results, which has a new field for statistics of blocks whose type differs from the allocator (foreign_blocks).

In an earlier iteration of this PR @ferd asked if this could negatively impact memory fragmentation now that there's no longer a hard barrier between different types, and my reply was a bit too curt. It's a good question, and the long answer is "yes" but we're sure that the effect will be limited.

Carriers inside the migration pool can't be used for allocation, and a carrier is only abandoned and placed in the pool when it's practically empty (user-configurable) in the hopes that we can deallocate it soon. When a carrier is fetched from the pool it won't be abandoned until it's practically empty again, and since allocators prefer the carriers they've abandoned over searching the pool (with some caveats), carriers tend to stick with their allocator unless something drastic happens.

Keeping things separate could of course be better for certain workloads and we're open to adding options to control which types a carrier can migrate between, but it's not a part of this PR.

@jhogberg jhogberg self-assigned this Jun 29, 2018

@jhogberg jhogberg merged commit 6cfa8af into erlang:master Jul 3, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
license/cla Contributor License Agreement is signed.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.