-
Notifications
You must be signed in to change notification settings - Fork 18.7k
runtime: floor cgroup CPU limits in adjustCgroupGOMAXPROCS #76863
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
base: master
Are you sure you want to change the base?
runtime: floor cgroup CPU limits in adjustCgroupGOMAXPROCS #76863
Conversation
…oupGOMAXPROCS Change the computation to use floor instead, ensuring GOMAXPROCS never exceeds the available cgroup CPU quota under fractional values. Fractional CPU limits now round down, except values less than 2 still round up to 2 to preserve minimum parallelism. This reduces contention and CPU throttling observed in production deployments with fractional CPU quotas. Proposal: golang#76835 Fixes golang#76835
|
This PR (HEAD: 85d1142) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/730601. Important tips:
|
|
Message from Gopher Robot: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/730601. |
|
Message from Gopher Robot: Patch Set 1: Congratulations on opening your first change. Thank you for your contribution! Next steps: Most changes in the Go project go through a few rounds of revision. This can be During May-July and Nov-Jan the Go project is in a code freeze, during which Please don’t reply on this GitHub thread. Visit golang.org/cl/730601. |
|
Message from Marcos P. Sánchez: Patch Set 2: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/730601. |
|
Message from Sean Liao: Patch Set 3: Hold+1 (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/730601. |


adjustCgroupGOMAXPROCS derives GOMAXPROCS from the cgroup CPU quota. When the quota is fractional, the current computation rounds up, which can set GOMAXPROCS above the available CPU quota.
Round fractional quotas down instead. Keep the existing minimum of 2 for very small quotas to preserve a baseline level of parallelism.
This reduces contention and CPU throttling in production deployments using fractional CPU quotas.
Proposal: #76835
Fixes #76835