Skip to content

rustc_thread_pool: Make CoreLatch::set use SeqCst instead of AcqRel#155609

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
cuviper:thread_pool-seq-cst
Apr 23, 2026
Merged

rustc_thread_pool: Make CoreLatch::set use SeqCst instead of AcqRel#155609
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
cuviper:thread_pool-seq-cst

Conversation

@cuviper

@cuviper cuviper commented Apr 21, 2026

Copy link
Copy Markdown
Member

Every other modification of this variable uses SeqCst, which is justified in the sleep README. This particular choice of AcqRel was not discussed during its addition in rayon-rs/rayon#746, nor rayon-rs/rfcs#5, so I suspect was simply an oversight from earlier development. We probably do want this to participate in the same sequential consistency.

The only other ordering difference is CoreLatch::probe's load with Acquire, which should be fine because this doesn't need consistency with the sleep counters.

See also rayon-rs/rayon#1297. As I commented there, I think in practice this would be quite rare to cause any problems, but it could be a source of non-deterministic bugs on targets with weak memory ordering.

…Rel`

Every other modification of this variable uses `SeqCst`, which is
justified in the sleep README. This particular choice of `AcqRel` was
not discussed during its addition in rayon-rs/rayon#746, nor
rayon-rs/rfcs#5, so I suspect was simply an oversight from earlier
development. We probably do want this to participate in the same
sequential consistency.

The only other ordering difference is `CoreLatch::probe`'s load with
`Acquire`, which should be fine because this doesn't need consistency
with the sleep counters.

See also rayon-rs/rayon#1297. As I commented there, I think in practice
this would be quite rare to cause any problems, but it *could* be a
source of non-deterministic bugs on targets with weak memory ordering.
@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 Apr 21, 2026
@rustbot

rustbot commented Apr 21, 2026

Copy link
Copy Markdown
Collaborator

r? @jieyouxu

rustbot has assigned @jieyouxu.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 72 candidates
  • Random selection from 18 candidates

@rustbot

rustbot commented Apr 21, 2026

Copy link
Copy Markdown
Collaborator

⚠️ Warning ⚠️

  • There are issue links (such as #123) in the commit messages of the following commits.
    Please move them to the PR description, to avoid spamming the issues with references to the commit, and so this bot can automatically canonicalize them to avoid issues with subtree.

@jieyouxu jieyouxu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Make sense to me, thanks.

@bors r+ rollup=never (just in case)

View changes since this review

@rust-bors

rust-bors Bot commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 29ccf67 has been approved by jieyouxu

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 Apr 22, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Apr 22, 2026
rustc_thread_pool: Make `CoreLatch::set` use `SeqCst` instead of `AcqRel`

Every other modification of this variable uses `SeqCst`, which is justified in the sleep README. This particular choice of `AcqRel` was not discussed during its addition in rayon-rs/rayon#746, nor rayon-rs/rfcs#5, so I suspect was simply an oversight from earlier development. We probably do want this to participate in the same sequential consistency.

The only other ordering difference is `CoreLatch::probe`'s load with `Acquire`, which should be fine because this doesn't need consistency with the sleep counters.

See also rayon-rs/rayon#1297. As I commented there, I think in practice this would be quite rare to cause any problems, but it *could* be a source of non-deterministic bugs on targets with weak memory ordering.
@bjorn3

bjorn3 commented Apr 22, 2026

Copy link
Copy Markdown
Member

CI has been running for over 5h30min.

@rust-bors rust-bors Bot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 22, 2026
@rust-bors

rust-bors Bot commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

💥 Test timed out after 21600s

@cuviper

cuviper commented Apr 22, 2026

Copy link
Copy Markdown
Member Author

The timeout was aarch64-apple -- which could conceivably be affected as an arch with weaker memory ordering, but this change should only be more strict. So I hope that was just spurious CI, but let's try first...

@bors try jobs=aarch64-apple

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Apr 22, 2026
rustc_thread_pool: Make `CoreLatch::set` use `SeqCst` instead of `AcqRel`


try-job: aarch64-apple
@rust-bors

rust-bors Bot commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 9dab398 (9dab398030c4363ac24019a1862d452856ef80ab, parent: cf1817bc6ecd2d14ca492247c804bad31948dd56)

@JonathanBrouwer

Copy link
Copy Markdown
Contributor

@bors retry

@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 Apr 22, 2026
@jieyouxu

jieyouxu commented Apr 23, 2026

Copy link
Copy Markdown
Member

The timeout was aarch64-apple

The aarch64-apple job sometimes randomly not progressing is known, never quite figured out why

@rust-bors

This comment has been minimized.

@rust-bors rust-bors Bot added merged-by-bors This PR was explicitly merged by bors. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 23, 2026
@rust-bors

rust-bors Bot commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

☀️ Test successful - CI
Approved by: jieyouxu
Duration: 3h 7m 30s
Pushing 92c7010 to main...

@rust-bors rust-bors Bot merged commit 92c7010 into rust-lang:main Apr 23, 2026
13 checks passed
@rustbot rustbot added this to the 1.97.0 milestone Apr 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor
What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 5095b44 (parent) -> 92c7010 (this PR)

Test differences

Show 4 test diffs

4 doctest diffs were found. These are ignored, as they are noisy.

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 92c7010294007f9bb819f0ddd9d9e9b5ccd5714a --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. i686-gnu-nopt-2: 1h 41m -> 2h 17m (+35.9%)
  2. dist-aarch64-apple: 1h 46m -> 2h 18m (+30.2%)
  3. aarch64-apple: 3h 42m -> 2h 46m (-25.0%)
  4. i686-gnu-nopt-1: 2h 22m -> 1h 51m (-21.8%)
  5. x86_64-mingw-2: 2h 13m -> 2h 40m (+20.8%)
  6. dist-apple-various: 1h 48m -> 1h 31m (-15.5%)
  7. x86_64-gnu-gcc: 1h 2m -> 1h 11m (+14.5%)
  8. tidy: 2m 31s -> 2m 50s (+12.9%)
  9. pr-check-2: 39m 24s -> 43m 52s (+11.3%)
  10. x86_64-gnu-miri: 1h 28m -> 1h 37m (+9.8%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (92c7010): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

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

Max RSS (memory usage)

Results (secondary -4.2%)

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

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-4.2% [-5.2%, -2.7%] 3
All ❌✅ (primary) - - 0

Cycles

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

Binary size

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

Bootstrap: 494.354s -> 500.795s (1.30%)
Artifact size: 394.34 MiB -> 394.31 MiB (-0.01%)

@cuviper cuviper deleted the thread_pool-seq-cst branch June 1, 2026 15:54
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. 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.

6 participants