-
Notifications
You must be signed in to change notification settings - Fork 39.3k
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
kubelet: Fix the bug of getting the number of windows cpu #97378
Conversation
/sig windows |
Is there a scheduling e2e or other test that we can have for this as a follow on PR? Seems like verifying this on windows nodes which already can have scheduling issues would be good for the windows conformance suites |
@jayunit100 My colleagues are testing it, but there are no results yet. I will continue to add if I get the results |
@jayunit100 we tested it on a server with 72 cores and 144 logical processors(There are a total of 4 cpus, each cpu has 18 cores). |
/triage accepted |
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.
This looks reasonable to me but I'm not a Windows reviewer, leaving for SIG Windows :)
procGlobalMemoryStatusEx = modkernel32.NewProc("GlobalMemoryStatusEx") | ||
modkernel32 = windows.NewLazySystemDLL("kernel32.dll") | ||
procGlobalMemoryStatusEx = modkernel32.NewProc("GlobalMemoryStatusEx") | ||
procGetActiveProcessorCount = modkernel32.NewProc("GetActiveProcessorCount") |
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.
@marosset |
// many of the Windows processor affinity functions will only return the information for a | ||
// single Processor Group. Since a single group can only hold 64 logical processors, this | ||
// means when there are more they will be divided into multiple groups. | ||
// for the above reason, the following function is used to get the cpu number of the windows node. |
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.
// for the above reason, the following function is used to get the cpu number of the windows node. | |
// For the above reason, procGetActiveProcessorCount is used to get the cpu count for all processor groups of the windows node. |
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.
Already modified, thanks for your review.
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 for your contribution! if you need a reviewer from sig-windows in the future you can find us in the sig-windows slack
/milestone v1.21 going to run our sig-windows tests for sanity: |
/lgtm |
I agree with the comments above about not being able to easily test this in e2e tests if it requires very large amounts of cores. |
@hwdef can you add a release note since this does fix a bug other users might run into at some point? |
/retest |
@marosset |
/assign @dchen1107 @mrunalp |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hwdef, mrunalp The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Is this going to be back-ported to 1.20 and below? Or is it available just on 1.21? |
just support on 1.21. Did not cherrypick to 1.20. |
fix the bug that the number of cpu cannot be obtained normally under Windows
What type of PR is this?
/kind bug
What this PR does / why we need it:
In some cases, kubelet will return an error value when obtaining the number of CPUs, only half of the correct value will be returned.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
I found the way to fix in https://github.com/microsoft/hcsshim/blob/master/internal/processorinfo/processor_count.go
same issue in moby: moby/moby#38935 (comment)
Does this PR introduce a user-facing change?:
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: