Skip to content

Commit

Permalink
Merge pull request #13 from uber-go/floor_not_ceil
Browse files Browse the repository at this point in the history
Use floor(quota) rather than ceil(quota)
  • Loading branch information
jcorbin committed Feb 23, 2018
2 parents 6fecebd + 58c8fec commit a884895
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## v1.2.0 (unreleased)

- Fixed quota clamping to always round down rather than up; Rather than
guaranteeing constant throttling at saturation, instead assume that the
fractional CPU was added as a hedge for factors outside of Go's scheduler.

## v1.1.0 (2017-11-10)

- Log the new value of `GOMAXPROCS` rather than the current value.
Expand Down
2 changes: 1 addition & 1 deletion internal/runtime/cpu_quota_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func CPUQuotaToGOMAXPROCS(minValue int) (int, CPUQuotaStatus, error) {
return -1, CPUQuotaUndefined, err
}

maxProcs := int(math.Ceil(quota))
maxProcs := int(math.Floor(quota))
if minValue > 0 && maxProcs < minValue {
return minValue, CPUQuotaMinUsed, nil
}
Expand Down

0 comments on commit a884895

Please sign in to comment.