-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
sync/atomic: operations cause unnecessary escapes #16241
Labels
Milestone
Comments
quentinmit
added
the
NeedsFix
The path to resolution is known, but the work has not been done.
label
Oct 10, 2016
bradfitz
added
early-in-cycle
A change that should be done early in the 3 month dev cycle.
and removed
early-in-cycle
A change that should be done early in the 3 month dev cycle.
labels
Jun 14, 2017
odeke-em
removed
the
early-in-cycle
A change that should be done early in the 3 month dev cycle.
label
Feb 4, 2019
ijsong
added a commit
to kakao/varlog
that referenced
this issue
Aug 5, 2022
Using atomic operations makes a variable to escape to the heap. See golang/go#16241. This PR changes reportCommitBase to use shared mutex rather than atomic. Resolves [#VARLOG-529](https://jira.daumkakao.com/browse/VARLOG-529).
ijsong
added a commit
to kakao/varlog
that referenced
this issue
Aug 8, 2022
Using atomic operations makes a variable to escape to the heap. See golang/go#16241. This PR changes reportCommitBase to use shared mutex rather than atomic. Resolves [#VARLOG-529](https://jira.daumkakao.com/browse/VARLOG-529).
ijsong
added a commit
to kakao/varlog
that referenced
this issue
Aug 9, 2022
Using atomic operations makes a variable to escape to the heap. See golang/go#16241. This PR changes reportCommitBase to use shared mutex rather than atomic. Resolves [#VARLOG-529](VARLOG-529).
ijsong
added a commit
to kakao/varlog
that referenced
this issue
Aug 9, 2022
Using atomic operations makes a variable to escape to the heap. See golang/go#16241. This PR changes reportCommitBase to use shared mutex rather than atomic. Resolves [#VARLOG-529](VARLOG-529).
ijsong
added a commit
to kakao/varlog
that referenced
this issue
Aug 9, 2022
Using atomic operations makes a variable to escape to the heap. See golang/go#16241. This PR changes reportCommitBase to use shared mutex rather than atomic. Resolves [#VARLOG-529](VARLOG-529).
ijsong
added a commit
to kakao/varlog
that referenced
this issue
Aug 9, 2022
Using atomic operations makes a variable to escape to the heap. See golang/go#16241. This PR changes reportCommitBase to use shared mutex rather than atomic. Resolves [#VARLOG-529](VARLOG-529).
ijsong
added a commit
to kakao/varlog
that referenced
this issue
Aug 9, 2022
Using atomic operations makes a variable to escape to the heap. See golang/go#16241. This PR changes reportCommitBase to use shared mutex rather than atomic. Resolves [#VARLOG-529](VARLOG-529).
ijsong
added a commit
to kakao/varlog
that referenced
this issue
Aug 9, 2022
Using atomic operations makes a variable to escape to the heap. See golang/go#16241. This PR changes reportCommitBase to use shared mutex rather than atomic. Resolves [#VARLOG-529](VARLOG-529).
ijsong
added a commit
to kakao/varlog
that referenced
this issue
Aug 9, 2022
Using atomic operations makes a variable to escape to the heap. See golang/go#16241. This PR changes reportCommitBase to use shared mutex rather than atomic. Resolves [#VARLOG-529](VARLOG-529).
ijsong
added a commit
to kakao/varlog
that referenced
this issue
Aug 9, 2022
Using atomic operations makes a variable to escape to the heap. See golang/go#16241. This PR changes reportCommitBase to use shared mutex rather than atomic. Resolves [#VARLOG-529](VARLOG-529).
ijsong
added a commit
to kakao/varlog
that referenced
this issue
Aug 9, 2022
Using atomic operations makes a variable to escape to the heap. See golang/go#16241. This PR changes reportCommitBase to use shared mutex rather than atomic. Resolves [#VARLOG-529](VARLOG-529).
ijsong
added a commit
to kakao/varlog
that referenced
this issue
Aug 9, 2022
Using atomic operations makes a variable to escape to the heap. See golang/go#16241. This PR changes reportCommitBase to use shared mutex rather than atomic. Resolves [#VARLOG-529](VARLOG-529).
ijsong
added a commit
to kakao/varlog
that referenced
this issue
Aug 10, 2022
Using atomic operations makes a variable to escape to the heap. See golang/go#16241. This PR changes reportCommitBase to use shared mutex rather than atomic. Resolves [#VARLOG-529](VARLOG-529).
ijsong
added a commit
to kakao/varlog
that referenced
this issue
Aug 10, 2022
Using atomic operations makes a variable to escape to the heap. See golang/go#16241. This PR changes reportCommitBase to use shared mutex rather than atomic. Resolves [#VARLOG-529](VARLOG-529).
ijsong
added a commit
to kakao/varlog
that referenced
this issue
Aug 10, 2022
Using atomic operations makes a variable to escape to the heap. See golang/go#16241. This PR changes reportCommitBase to use shared mutex rather than atomic. Resolves [#VARLOG-529](VARLOG-529).
Change https://go.dev/cl/462298 mentions this issue: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
The atomic Load* and Store* operations cause their argument to unnecessarily escape. For example, in the following program, x is heap allocated:
This is fairly low priority, since it's silly to use atomics on variables unless they're shared, and if the variable is shared it has to be in the heap anyway, but we should fix it since the same code path may be used for both shared and unshared data (there will obviously be unnecessary overhead from the atomics, but we can address the additional heap allocation overhead). This has been right for the runtime-internal atomics for some time, and we should simply copy what they do. In particular, we need to be careful with the *Pointer functions, since their values potentially do escape.
Pointed out by OneOfOne/lfchan#3 (comment)
The text was updated successfully, but these errors were encountered: