-
Notifications
You must be signed in to change notification settings - Fork 40.7k
fix: allocate reusableCPUs first before allocate other available CPUs to avoid CPU leaking when cpu-manager-policy=static #131966
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?
Conversation
Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Hi @Chunxia202410. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/sig node |
/ok-to-test |
4815c9a
to
d687e4e
Compare
/test pull-kubernetes-e2e-kind-ipv6 |
d687e4e
to
2cc77e6
Compare
/assign this is a quite delicate fix in a key area of cpu management. We will need:
|
cdb95aa
to
b300a34
Compare
/test pull-kubernetes-unit-windows-master |
c753094
to
ca0cb48
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Chunxia202410 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
ca0cb48
to
2ad6a19
Compare
/test pull-kubernetes-unit |
2ad6a19
to
0906e4a
Compare
Update PR description.
Add 5 e2e test cases in cpumanager_test.go.
Add feature gate InheritReusableCPUsFirst @ffromani , I have modified the PR description and code based on your suggestion, please take a look, thank you very much. |
361a188
to
926bf3c
Compare
/test pull-kubernetes-unit-windows-master |
b8f1961
to
157e38a
Compare
157e38a
to
e238ae6
Compare
/test pull-kubernetes-e2e-gce |
@@ -976,6 +976,18 @@ const ( | |||
// operation when scheduling a Pod by setting the `metadata.labels` field on the submitted Binding, | |||
// similar to how `metadata.annotations` behaves. | |||
PodTopologyLabelsAdmission featuregate.Feature = "PodTopologyLabelsAdmission" | |||
|
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.
I think with the introduction of a new feature gate, versioned_kube_features.go and versioned_feature_list.yaml need to be updated as well.
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.
Thanks you for your comments, I have already updated the versioned_feature_list.yaml file. Could you clarify if I missed any required modifications in this file?
And the code in versioned_kube_features.go have been moved to kube_features.go in this commit, I have also updated the feature version mappings in kube_features.go accordingly.
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.
Thanks i missed that.
e238ae6
to
9d49b9b
Compare
…void CPU leaking when cpu-manager-policy=static
9d49b9b
to
85b45af
Compare
What type of PR is this?
/kind bug
What this PR does / why we need it:
In the case of
cpu-manager-policy=static
, when allocate CPUs to a container of a pod, the CPU manager supports reusing the CPUs which have been allocated to the non-restartable Init containers of the pod.But In some cases, the app container can not reuse the CPU of Init containers, which lead to CPU leaking.
For example:
defaultCpuSet: {{0,10},{1,11},{2,12},{3,13},{4,14},{5,15},{6,16},{7,17},{8,18},{9,19}}
system reserved CPU: {0}
For a pod, Init container request 1 CPU, and app container request 2 CPUs.
the result in the cpu_manager_state is
CPU leakage means that this CPU not be used by the app container, and also can not be used by other pod, because it not release to the defaultCpuSet.
CPU leakage may cause the error UnexpectedAdmissionError to occur when create a new pod, because the number of available CPUs in the scheduler does not match the number of available CPUs in kubelet. The detail please refer to #129556 (comment).
There are two possible solutions (#112228 (comment))
If my implement correctly for Solution2 in #131764, it has been proved that it might not a good solution, because it can not cover the pod restart case.
This PR implement the solution1, allocate reusableCPUs first before allocate other available CPUs.
Which issue(s) this PR fixes:
Fixes #112228