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

structure alignment for 386 #249

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,15 @@ func (p *defaultPolicy) UpdateMaxCost(maxCost int64) {

// sampledLFU is an eviction helper storing key-cost pairs.
type sampledLFU struct {
keyCosts map[uint64]int64
// NOTE: align maxCost to 64-bit boundary for use with atomic.
// As per https://golang.org/pkg/sync/atomic/: "On ARM, x86-32,
// and 32-bit MIPS, it is the caller’s responsibility to arrange
// for 64-bit alignment of 64-bit words accessed atomically.
// The first word in a variable or in an allocated struct, array,
// or slice can be relied upon to be 64-bit aligned."
maxCost int64
used int64
keyCosts map[uint64]int64
metrics *Metrics
}

Expand Down