Skip to content

Tell stacker about the correct initial stack size - #158754

Closed
saethlin wants to merge 1 commit into
rust-lang:mainfrom
saethlin:more-stack-per-recursion
Closed

Tell stacker about the correct initial stack size#158754
saethlin wants to merge 1 commit into
rust-lang:mainfrom
saethlin:more-stack-per-recursion

Conversation

@saethlin

@saethlin saethlin commented Jul 3, 2026

Copy link
Copy Markdown
Member

I've been debugging #138889, and I think this is a fix.

Android is not supported by stacker. So it ends up in the fallback case, where stacker cannot determine what the initial stack size is. So the first call to stacker::maybe_grow allocates a stack of the passed-in size. On Android, this would immediately shrink the initial stack size from 8 MB from 1 MB, and then we blow the (now much smaller) stack with recursive calls.

I think the problem in the compiler is that we should never pass stacker::maybe_grow a stack size that is smaller than the current stack, so I've moved code around so that the STACK_SIZE static that we set when the compiler is initialized in rustc_interface can be shared by rustc_data_structures.


I think the cfg(aix) was added in #131116 to fix the same problem, so it shouldn't be required anymore. target_os = "aix" is also unsupported by stacker.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 3, 2026
@saethlin

saethlin commented Jul 3, 2026

Copy link
Copy Markdown
Member Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 3, 2026
rust-bors Bot pushed a commit that referenced this pull request Jul 3, 2026
Tell stacker about the correct initial stack size
@rust-bors

rust-bors Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 6a21530 (6a2153010d3bb280dd46ae569f940c656b18d2f3)
Base parent: c397dae (c397dae808f70caebab1fc4e11b3edf7e59f58c7)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (6a21530): comparison URL.

Overall result: ❌ regressions - please read:

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

Next, please: If you can, justify the regressions found in this try perf run in writing along with @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.3% [0.2%, 0.4%] 8
Regressions ❌
(secondary)
0.4% [0.2%, 0.6%] 34
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.3% [0.2%, 0.4%] 8

Max RSS (memory usage)

This perf run didn't have relevant results for this metric.

Cycles

Results (primary 3.2%, secondary -1.0%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
3.2% [2.4%, 4.4%] 3
Regressions ❌
(secondary)
3.3% [3.0%, 3.5%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.9% [-6.0%, -2.7%] 3
All ❌✅ (primary) 3.2% [2.4%, 4.4%] 3

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 485.944s -> 486.323s (0.08%)
Artifact size: 393.37 MiB -> 393.30 MiB (-0.02%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jul 4, 2026
@rust-bors

rust-bors Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #160535) made this pull request unmergeable. Please resolve the merge conflicts by rebasing.

@saethlin

Copy link
Copy Markdown
Member Author

Closing because we don't use stacker anymore

@saethlin saethlin closed this Aug 10, 2026
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

perf-regression Performance regression. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants