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

kubelet: Fix the bug of getting the number of windows cpu #97378

Merged
merged 1 commit into from Mar 16, 2021

Conversation

hwdef
Copy link
Member

@hwdef hwdef commented Dec 18, 2020

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?:

kubelet: Fixed the bug of getting the number of cpu when the number of cpu logical processors is more than 64 in windows

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added release-note-none kind/bug size/S cncf-cla: yes do-not-merge/needs-sig needs-triage needs-priority labels Dec 18, 2020
@k8s-ci-robot k8s-ci-robot added area/kubelet sig/node and removed do-not-merge/needs-sig labels Dec 18, 2020
@hwdef
Copy link
Member Author

@hwdef hwdef commented Dec 18, 2020

/sig windows

@k8s-ci-robot k8s-ci-robot added the sig/windows label Dec 18, 2020
@hwdef
Copy link
Member Author

@hwdef hwdef commented Dec 18, 2020

/assign @liggitt @thockin @mrunalp

@jayunit100
Copy link
Member

@jayunit100 jayunit100 commented Dec 19, 2020

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

@hwdef
Copy link
Member Author

@hwdef hwdef commented Dec 19, 2020

@jayunit100 My colleagues are testing it, but there are no results yet. I will continue to add if I get the results

@hwdef
Copy link
Member Author

@hwdef hwdef commented Dec 22, 2020

@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).

image

Screenshot_20201222_1427131

@ehashman ehashman added this to Needs Reviewer in SIG Node PR Triage Jan 6, 2021
@ehashman
Copy link
Member

@ehashman ehashman commented Jan 25, 2021

/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted and removed needs-triage labels Jan 25, 2021
@marosset marosset added this to In Review (v1.21) in SIG-Windows Feb 11, 2021
Copy link
Member

@ehashman ehashman left a comment

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")
Copy link
Member

@ehashman ehashman Feb 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hwdef
Copy link
Member Author

@hwdef hwdef commented Feb 18, 2021

@marosset
Could you give me some help?

// 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.
Copy link
Contributor

@jsturtevant jsturtevant Mar 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// 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.

Copy link
Member Author

@hwdef hwdef Mar 12, 2021

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.

Copy link
Contributor

@jsturtevant jsturtevant Mar 12, 2021

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

@mrunalp mrunalp moved this from Needs Approver to Waiting on Author in SIG Node PR Triage Mar 11, 2021
@k8s-ci-robot k8s-ci-robot added size/M and removed size/S labels Mar 12, 2021
@jsturtevant
Copy link
Contributor

@jsturtevant jsturtevant commented Mar 12, 2021

/milestone v1.21
/priority important-soon
/lgtm

going to run our sig-windows tests for sanity:
/test pull-kubernetes-e2e-aks-engine-windows-containerd

@k8s-ci-robot k8s-ci-robot added the priority/important-soon label Mar 12, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.21 milestone Mar 12, 2021
@k8s-ci-robot k8s-ci-robot added lgtm and removed needs-priority labels Mar 12, 2021
@marosset
Copy link
Contributor

@marosset marosset commented Mar 12, 2021

/lgtm

@marosset
Copy link
Contributor

@marosset marosset commented Mar 12, 2021

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.

@marosset
Copy link
Contributor

@marosset marosset commented Mar 12, 2021

@hwdef can you add a release note since this does fix a bug other users might run into at some point?

@marosset
Copy link
Contributor

@marosset marosset commented Mar 12, 2021

/retest

@k8s-ci-robot k8s-ci-robot added release-note and removed release-note-none labels Mar 12, 2021
@hwdef
Copy link
Member Author

@hwdef hwdef commented Mar 12, 2021

@marosset
Thanks for your reminder, I have added the release note.

@marosset
Copy link
Contributor

@marosset marosset commented Mar 12, 2021

/assign @dchen1107 @mrunalp
For pkg\kubelet approval.

@ehashman ehashman moved this from Waiting on Author to Needs Approver in SIG Node PR Triage Mar 12, 2021
@mrunalp
Copy link
Contributor

@mrunalp mrunalp commented Mar 16, 2021

/approve

@mrunalp mrunalp moved this from Needs Approver to Done in SIG Node PR Triage Mar 16, 2021
@k8s-ci-robot
Copy link
Contributor

@k8s-ci-robot k8s-ci-robot commented Mar 16, 2021

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved label Mar 16, 2021
@k8s-ci-robot k8s-ci-robot merged commit c2ad998 into kubernetes:master Mar 16, 2021
14 of 15 checks passed
SIG-Windows automation moved this from Reviewed - Needs Approval From Other SIGs to Done (v1.21) Mar 16, 2021
@singholt
Copy link

@singholt singholt commented Aug 17, 2021

Is this going to be back-ported to 1.20 and below? Or is it available just on 1.21?

@hwdef
Copy link
Member Author

@hwdef hwdef commented Aug 18, 2021

@singholt

just support on 1.21. Did not cherrypick to 1.20.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved area/kubelet cncf-cla: yes kind/bug lgtm priority/important-soon release-note sig/node sig/windows size/M triage/accepted
Projects
SIG-Windows
  
Done (v1.21)
Development

Successfully merging this pull request may close these issues.

None yet