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

Make sure arenas don't allocate bigger than HUGE_PAGE #78058

Merged
merged 1 commit into from
Oct 18, 2020

Conversation

bugadani
Copy link
Contributor

Right now, arenas allocate based on the size of the last chunk. It is possible for a grow call to allocate a chunk that is not a multiple of PAGE, and this size is doubled for each subsequent allocation. This means, instead of HUGE_PAGE, the biggest page possible is actually unknown.

This change fixes this, and also removes an unnecessary checked multiplication. It is still possible to allocate bigger than HUGE_PAGE pages, but this will only happen as many times as absolutely necessary.

@rust-highfive
Copy link
Collaborator

r? @lcnr

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 17, 2020
@bugadani bugadani changed the title Make sure arenas don't allocate bigger than HUGE_PAGE Make sure arenas not allocate bigger than HUGE_PAGE Oct 17, 2020
@bugadani bugadani changed the title Make sure arenas not allocate bigger than HUGE_PAGE Make sure arenas don't allocate bigger than HUGE_PAGE Oct 17, 2020
Copy link
Contributor

@lcnr lcnr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you expect this changes to have an influence on perf?

compiler/rustc_arena/src/lib.rs Outdated Show resolved Hide resolved
@bugadani
Copy link
Contributor Author

bugadani commented Oct 17, 2020

Hard to say, I lean on "not really". Shouldn't degrade perf, at least.

@lcnr
Copy link
Contributor

lcnr commented Oct 17, 2020

this code is really hot, so it's better to be safe here

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion

@bors
Copy link
Contributor

bors commented Oct 17, 2020

⌛ Trying commit 396561b with merge e270068a34bb00af7da331d9029c3b5ce2dad3d3...

@bors
Copy link
Contributor

bors commented Oct 17, 2020

☀️ Try build successful - checks-actions, checks-azure
Build commit: e270068a34bb00af7da331d9029c3b5ce2dad3d3 (e270068a34bb00af7da331d9029c3b5ce2dad3d3)

@rust-timer
Copy link
Collaborator

Queued e270068a34bb00af7da331d9029c3b5ce2dad3d3 with parent ffeeb20, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit (e270068a34bb00af7da331d9029c3b5ce2dad3d3): comparison url.

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying rollup- to bors.

Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up.

@bors rollup=never

@jyn514
Copy link
Member

jyn514 commented Oct 18, 2020

Looks like no impact.

@lcnr
Copy link
Contributor

lcnr commented Oct 18, 2020

well, then

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Oct 18, 2020

📌 Commit 396561b has been approved by lcnr

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 18, 2020
@bors
Copy link
Contributor

bors commented Oct 18, 2020

⌛ Testing commit 396561b with merge 98e1688...

@bors
Copy link
Contributor

bors commented Oct 18, 2020

☀️ Test successful - checks-actions, checks-azure
Approved by: lcnr
Pushing 98e1688 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Oct 18, 2020
@bors bors merged commit 98e1688 into rust-lang:master Oct 18, 2020
@rustbot rustbot added this to the 1.49.0 milestone Oct 18, 2020
@bugadani bugadani deleted the arena2 branch October 18, 2020 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants