Skip to content

Use thread::available_parallelism as the default limit for backend parallelism - #160424

Open
petrochenkov wants to merge 1 commit into
rust-lang:mainfrom
petrochenkov:jobdflt
Open

Use thread::available_parallelism as the default limit for backend parallelism#160424
petrochenkov wants to merge 1 commit into
rust-lang:mainfrom
petrochenkov:jobdflt

Conversation

@petrochenkov

Copy link
Copy Markdown
Contributor

Instead of the old scheme with 32-or-unlimited, depending on inherited-ness of the jobserver.

Not sure if this needs some wider discussion or not.
In the most common case (rustc is called from cargo) nothing changes, because cargo already limits the parallelism to thread::available_parallelism by default, and passes this limit to rustc through jobserver.

#160387 will become simpler if this PR is merged first.
r? @bjorn3 @Zoxc

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 3, 2026
@Kobzol

Kobzol commented Aug 3, 2026

Copy link
Copy Markdown
Member

CC @nnethercote , I remember you mentioning that having a thread per CGU made profiling simpler-ish, or something like that?

@bjorn3

bjorn3 commented Aug 3, 2026

Copy link
Copy Markdown
Member

Makes sense.

@bors r+

@rust-bors

rust-bors Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 496056f has been approved by bjorn3

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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 Aug 3, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 3, 2026
Use `thread::available_parallelism` as the default limit for backend parallelism

Instead of the old scheme with 32-or-unlimited, depending on inherited-ness of the jobserver.

Not sure if this needs some wider discussion or not.
In the most common case (rustc is called from cargo) nothing changes, because cargo already limits the parallelism to `thread::available_parallelism` by default, and passes this limit to rustc through jobserver.

rust-lang#160387 will become simpler if this PR is merged first.
r? @bjorn3 @Zoxc
rust-bors Bot pushed a commit that referenced this pull request Aug 3, 2026
…uwer

Rollup of 21 pull requests

Successful merges:

 - #159844 (Subtree cg_gcc sync (2026-07-24))
 - #159326 (Deny multiple EII impls on a single item)
 - #159535 (Optimize slice::contains for bytewise types)
 - #159595 (Promote loongarch32-unknown-none* to Tier 2)
 - #160007 (allow `-Ldependency` search paths for panic runtimes)
 - #160320 (point at trait definition when it is used as a derive macro)
 - #160369 (When suggesting method names, prefer *exact* doc aliases over similar names)
 - #160406 (`DepKind` cleanups)
 - #160424 (Use `thread::available_parallelism` as the default limit for backend parallelism)
 - #159014 ([rustdoc] Do not take `doc(cfg())` into account when filtering doctests)
 - #159303 (Fix ICE for direct inline const generic defaults)
 - #159977 (Add regression test for bool indexing codegen)
 - #160165 (reject `...` without pattern post-expansion)
 - #160295 (Fix rustdoc ICE when checking if a generic arg can be elided)
 - #160305 (Linkify C-SKY targets in `platform-support.md`)
 - #160314 (fix borrowck ICE for consts with fn pointer type)
 - #160322 (ElaborateBoxDeref: remove unnecessary projection)
 - #160338 (Add regression test for supertrait associated type normalization through dyn)
 - #160340 (Add regression test for unused_parens on contract clauses)
 - #160371 (Add doc aliases for transpositions `read_exact_buf` and `read_exact_buf_at`)
 - #160384 (Add PR body notes for Cargo lock file maintenance)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 3, 2026
Use `thread::available_parallelism` as the default limit for backend parallelism

Instead of the old scheme with 32-or-unlimited, depending on inherited-ness of the jobserver.

Not sure if this needs some wider discussion or not.
In the most common case (rustc is called from cargo) nothing changes, because cargo already limits the parallelism to `thread::available_parallelism` by default, and passes this limit to rustc through jobserver.

rust-lang#160387 will become simpler if this PR is merged first.
r? @bjorn3 @Zoxc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

4 participants