-
Notifications
You must be signed in to change notification settings - Fork 407
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
Move int64s to top of struct to resolve alignment issue on ARM #2521
Conversation
storagenode/storagenodedb/infodb.go
Outdated
@@ -44,8 +44,8 @@ func newInfo(path string) (*InfoDB, error) { | |||
dbutil.Configure(db, mon) | |||
|
|||
infoDb := &InfoDB{db: db} | |||
infoDb.pieceinfo = pieceinfo{infoDb, spaceUsed{sync.Once{}, 0}} | |||
infoDb.bandwidthdb = bandwidthdb{infoDb, bandwidthUsed{sync.RWMutex{}, time.Time{}, 0}} | |||
infoDb.pieceinfo = pieceinfo{infoDb, spaceUsed{0, sync.Once{}}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay for this PR buuuut
definitely a strong preference to not create structs with unnamed, positional fields. always always use named fields in struct creation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
used int64 | ||
once sync.Once |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a comment why it's in a different order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -22,9 +22,9 @@ type bandwidthdb struct { | |||
} | |||
|
|||
type bandwidthUsed struct { | |||
used int64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a comment why it's in a different order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine, but what do you mean by an alignment issue?
* move int64s to top of struct to resolve alignment issue on ARM (cherry picked from commit f06aec0)
The's a known issue with certain 'atomic' methods on 64-bit datatypes on certain ARM processers. |
What:
Move int64s used in atomic operations to top of struct
Why:
Resolves alignment issue on ARM (golang/go#23345)
Please describe the tests:
Please describe the performance impact:
Code Review Checklist (to be filled out by reviewer)