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

runtime: convert atomic values to runtime/internal/atomic types #53821

Open
prattmic opened this issue Jul 12, 2022 · 24 comments
Open

runtime: convert atomic values to runtime/internal/atomic types #53821

prattmic opened this issue Jul 12, 2022 · 24 comments
Assignees
Labels
compiler/runtime
Milestone

Comments

@prattmic
Copy link
Member

prattmic commented Jul 12, 2022

runtime/internal/atomic added Int32, etc types a while ago, which are slowing getting used on new code. We should also go through existing code and convert bare atomic values to use the atomic types.

@prattmic prattmic added this to the Backlog milestone Jul 12, 2022
@prattmic prattmic self-assigned this Jul 12, 2022
@gopherbot gopherbot added the compiler/runtime label Jul 12, 2022
@gopherbot
Copy link

gopherbot commented Jul 15, 2022

Change https://go.dev/cl/417784 mentions this issue: runtime: convert gcController.dedicatedMarkWorkersNeeded to atomic type

@gopherbot
Copy link

gopherbot commented Jul 15, 2022

Change https://go.dev/cl/417782 mentions this issue: runtime: convert gcController.fractionalMarkTime to atomic type

@gopherbot
Copy link

gopherbot commented Jul 15, 2022

Change https://go.dev/cl/417775 mentions this issue: runtime: convert gcController.heapLive to atomic type

@gopherbot
Copy link

gopherbot commented Jul 15, 2022

Change https://go.dev/cl/417778 mentions this issue: runtime: convert gcController.maxStackScan to atomic type

@gopherbot
Copy link

gopherbot commented Jul 15, 2022

Change https://go.dev/cl/417783 mentions this issue: runtime: convert gcController.idleMarkTime to atomic type

@gopherbot
Copy link

gopherbot commented Jul 15, 2022

Change https://go.dev/cl/417777 mentions this issue: runtime: convert gcController.lastStackScan to atomic type

@gopherbot
Copy link

gopherbot commented Jul 15, 2022

Change https://go.dev/cl/417781 mentions this issue: runtime: convert gcController.dedicatedMarkTime to atomic type

@gopherbot
Copy link

gopherbot commented Jul 15, 2022

Change https://go.dev/cl/417780 mentions this issue: runtime: convert gcController.bgScanCredit to atomic type

@gopherbot
Copy link

gopherbot commented Jul 15, 2022

Change https://go.dev/cl/417776 mentions this issue: runtime: convert gcController.heapScan to atomic type

@gopherbot
Copy link

gopherbot commented Jul 15, 2022

Change https://go.dev/cl/417779 mentions this issue: runtime: convert gcController.globalsScan to atomic type

@gopherbot
Copy link

gopherbot commented Jul 25, 2022

Change https://go.dev/cl/419444 mentions this issue: runtime: convert schedt.ngsys to atomic type

@gopherbot
Copy link

gopherbot commented Jul 25, 2022

Change https://go.dev/cl/419437 mentions this issue: runtime: convert runningPanicDefers to atomic type

@gopherbot
Copy link

gopherbot commented Jul 25, 2022

Change https://go.dev/cl/419438 mentions this issue: runtime: convert panicking to atomic type

@gopherbot
Copy link

gopherbot commented Jul 25, 2022

Change https://go.dev/cl/419442 mentions this issue: runtime: convert schedt.lastpoll to atomic type

@gopherbot
Copy link

gopherbot commented Jul 25, 2022

Change https://go.dev/cl/419445 mentions this issue: runtime: convert schedt.npidle to atomic type

@gopherbot
Copy link

gopherbot commented Jul 25, 2022

Change https://go.dev/cl/419443 mentions this issue: runtime: convert schedt.pollUntil to atomic type

@gopherbot
Copy link

gopherbot commented Jul 25, 2022

Change https://go.dev/cl/419439 mentions this issue: runtime: convert schedt.goidgen to atomic type

@gopherbot
Copy link

gopherbot commented Jul 25, 2022

Change https://go.dev/cl/419436 mentions this issue: runtime: convert pendingPreemptSignals to atomic type

@gopherbot
Copy link

gopherbot commented Jul 25, 2022

Change https://go.dev/cl/419446 mentions this issue: runtime: convert schedt.nmspinning to atomic type

@gopherbot
Copy link

gopherbot commented Jul 25, 2022

Change https://go.dev/cl/419448 mentions this issue: runtime: convert schedt.sysmonwait to atomic type

@gopherbot
Copy link

gopherbot commented Jul 25, 2022

Change https://go.dev/cl/419449 mentions this issue: runtime: convert timeHistogram to atomic types

@gopherbot
Copy link

gopherbot commented Jul 25, 2022

Change https://go.dev/cl/419447 mentions this issue: runtime: convert schedt.gcwaiting to atomic type

@gopherbot
Copy link

gopherbot commented Jul 29, 2022

Change https://go.dev/cl/420195 mentions this issue: runtime: convert prof.signalLock to atomic type

@gopherbot
Copy link

gopherbot commented Jul 29, 2022

Change https://go.dev/cl/420196 mentions this issue: runtime: convert prof.hz to atomic type

gopherbot pushed a commit that referenced this issue Aug 8, 2022
Atomic operations are used even during STW for consistency.

For #53821.

Change-Id: Ibe7afe5cf893b1288ce24fc96b7691b1f81754ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/417775
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopherbot pushed a commit that referenced this issue Aug 8, 2022
For #53821.

Change-Id: I64d3f53c89a579d93056906304e4c05fc35cd9b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/417776
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopherbot pushed a commit that referenced this issue Aug 8, 2022
For #53821.

Change-Id: I92bd33e355c868ae229395fd9c98fdb10768d03d
Reviewed-on: https://go-review.googlesource.com/c/go/+/417779
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
gopherbot pushed a commit that referenced this issue Aug 8, 2022
For #53821.

Change-Id: I9ccce3eb0adf4300095743c24a411213428306b4
Reviewed-on: https://go-review.googlesource.com/c/go/+/417780
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopherbot pushed a commit that referenced this issue Aug 8, 2022
For #53821.

Change-Id: I772b58b21392855af95ee5b932cdd7a0b507e4e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/417781
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Pratt <mpratt@google.com>
gopherbot pushed a commit that referenced this issue Aug 8, 2022
For #53821.

Change-Id: Ic54bda422b87ee9365090fe6b42b82df7b25d2a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/417782
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
gopherbot pushed a commit that referenced this issue Aug 8, 2022
For #53821.

Change-Id: I2f2b462908096dacb97fba9973798036ea1d9b68
Reviewed-on: https://go-review.googlesource.com/c/go/+/417783
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopherbot pushed a commit that referenced this issue Aug 8, 2022
In gcController.startCycle we just compute the initial value in a
local variable before assigning to the atomic field to avoid noisy
churn.

For #53821.

Change-Id: Ibde0ac8fd49aa6bbee3bd02fe3ffb17429abd5a9
Reviewed-on: https://go-review.googlesource.com/c/go/+/417784
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
jproberts pushed a commit to jproberts/go that referenced this issue Aug 10, 2022
Atomic operations are used even during STW for consistency.

For golang#53821.

Change-Id: Ibe7afe5cf893b1288ce24fc96b7691b1f81754ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/417775
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
jproberts pushed a commit to jproberts/go that referenced this issue Aug 10, 2022
For golang#53821.

Change-Id: I64d3f53c89a579d93056906304e4c05fc35cd9b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/417776
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
jproberts pushed a commit to jproberts/go that referenced this issue Aug 10, 2022
For golang#53821.

Change-Id: I6a7dcc9b72683e977a2b8d90e521a53a8a508558
Reviewed-on: https://go-review.googlesource.com/c/go/+/417777
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
jproberts pushed a commit to jproberts/go that referenced this issue Aug 10, 2022
For golang#53821.

Change-Id: I1bd23cdbc371011ec2331fb0a37482ecf99a063b
Reviewed-on: https://go-review.googlesource.com/c/go/+/417778
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
jproberts pushed a commit to jproberts/go that referenced this issue Aug 10, 2022
For golang#53821.

Change-Id: I92bd33e355c868ae229395fd9c98fdb10768d03d
Reviewed-on: https://go-review.googlesource.com/c/go/+/417779
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
jproberts pushed a commit to jproberts/go that referenced this issue Aug 10, 2022
For golang#53821.

Change-Id: I9ccce3eb0adf4300095743c24a411213428306b4
Reviewed-on: https://go-review.googlesource.com/c/go/+/417780
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
jproberts pushed a commit to jproberts/go that referenced this issue Aug 10, 2022
For golang#53821.

Change-Id: I772b58b21392855af95ee5b932cdd7a0b507e4e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/417781
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Pratt <mpratt@google.com>
jproberts pushed a commit to jproberts/go that referenced this issue Aug 10, 2022
For golang#53821.

Change-Id: Ic54bda422b87ee9365090fe6b42b82df7b25d2a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/417782
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
jproberts pushed a commit to jproberts/go that referenced this issue Aug 10, 2022
For golang#53821.

Change-Id: I2f2b462908096dacb97fba9973798036ea1d9b68
Reviewed-on: https://go-review.googlesource.com/c/go/+/417783
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
jproberts pushed a commit to jproberts/go that referenced this issue Aug 10, 2022
In gcController.startCycle we just compute the initial value in a
local variable before assigning to the atomic field to avoid noisy
churn.

For golang#53821.

Change-Id: Ibde0ac8fd49aa6bbee3bd02fe3ffb17429abd5a9
Reviewed-on: https://go-review.googlesource.com/c/go/+/417784
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopherbot pushed a commit that referenced this issue Aug 12, 2022
For #53821.

Change-Id: I106adbcb00b7b887d54001c2d7d97345a13cc662
Reviewed-on: https://go-review.googlesource.com/c/go/+/419436
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
gopherbot pushed a commit that referenced this issue Aug 12, 2022
For #53821.

Change-Id: Ib48a1f2ff85d667c86dbd0b7662efab5a0abd837
Reviewed-on: https://go-review.googlesource.com/c/go/+/419437
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
gopherbot pushed a commit that referenced this issue Aug 12, 2022
For #53821.

Change-Id: I93409f377881a3c029b41b0f1fbcef5e21091f2f
Reviewed-on: https://go-review.googlesource.com/c/go/+/419438
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopherbot pushed a commit that referenced this issue Aug 12, 2022
For #53821.

Change-Id: I84c96ade5982b8e68d1d1787bf1bfa16a17a4fb4
Reviewed-on: https://go-review.googlesource.com/c/go/+/419439
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopherbot pushed a commit that referenced this issue Aug 12, 2022
Note that this changes the type from uint64 to int64, the type used by
nanotime(). It also adds an atomic load in pollWork(), which used to use
a non-atomic load.

For #53821.

Change-Id: I6173c90f20bfdc0e0a4bc3a7b1c798d1c429fff5
Reviewed-on: https://go-review.googlesource.com/c/go/+/419442
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopherbot pushed a commit that referenced this issue Aug 12, 2022
Note that this converts pollUntil from uint64 to int64, the type used by
nanotime().

For #53821.

Change-Id: Iec9ec7e09d3350552561d0708ba6ea9e8a8ae7ab
Reviewed-on: https://go-review.googlesource.com/c/go/+/419443
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopherbot pushed a commit that referenced this issue Aug 12, 2022
Note that this converts ngsys from uint32 to int32 to match the other
(non-atomic) counters.

For #53821.

Change-Id: I3acbfbbd1dabc59b0ea5ddc86a97e0d0afa9f80c
Reviewed-on: https://go-review.googlesource.com/c/go/+/419444
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
gopherbot pushed a commit that referenced this issue Aug 12, 2022
Note that this converts npidle from uint32 to int32 for consistency with
the other count fields in schedt and the type of p.id.

Note that this changes previously unsynchronized operations to
synchronized operations in:
  * handoffp
  * injectglist
  * schedtrace
  * schedEnableUser
  * sync_runtime_canSpin

For #53821.

Change-Id: I36d1b3b4a28131c9d47884fade6bc44439dd6937
Reviewed-on: https://go-review.googlesource.com/c/go/+/419445
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
gopherbot pushed a commit that referenced this issue Aug 12, 2022
Note that this converts nmspinning from uint32 to int32 for consistency
with the other count fields in schedt.

For #53821.

Change-Id: Ia6ca7a2b476128eda3b68e9f0c7775ae66c0c744
Reviewed-on: https://go-review.googlesource.com/c/go/+/419446
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Austin Clements <austin@google.com>
gopherbot pushed a commit that referenced this issue Aug 12, 2022
Note that this replaces numerous unsynchronized loads throughout the
scheduler.

For #53821.

Change-Id: Ica80b04c9e8c184bfef186e549526fc3f117c387
Reviewed-on: https://go-review.googlesource.com/c/go/+/419447
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopherbot pushed a commit that referenced this issue Aug 12, 2022
This converts a few unsynchronized accesses.

For #53821.

Change-Id: Ie2728779111e3e042696f15648981c5d5a86ca6d
Reviewed-on: https://go-review.googlesource.com/c/go/+/419448
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
gopherbot pushed a commit that referenced this issue Aug 12, 2022
I've dropped the note that sched.timeToRun is protected by sched.lock,
as it does not seem to be true.

For #53821.

Change-Id: I03f8dc6ca0bcd4ccf3ec113010a0aa39c6f7d6ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/419449
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Pratt <mpratt@google.com>
gopherbot pushed a commit that referenced this issue Aug 12, 2022
For #53821.

Change-Id: I3e757fc6a020be10ee69459c395cb7eee49b0dfb
Reviewed-on: https://go-review.googlesource.com/c/go/+/420195
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
gopherbot pushed a commit that referenced this issue Aug 12, 2022
This converts several unsynchronized reads (reads without holding
prof.signalLock) into atomic reads.

For #53821.
For #52912.

Change-Id: I421b96a22fbe26d699bcc21010c8a9e0f4efc276
Reviewed-on: https://go-review.googlesource.com/c/go/+/420196
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime
Projects
Status: Todo
Development

No branches or pull requests

2 participants