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

memory manager: specify the container cpuset.memory during the creation #98924

Conversation

cynepco3hahue
Copy link

What type of PR is this?

/kind cleanup

What this PR does / why we need it:
Set the container cpuset.memory during the creation and avoid an additional
call the resources update of the container.
Following the PR - #98019

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

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


Signed-off-by: Artyom Lukianov alukiano@redhat.com

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Feb 9, 2021
@k8s-ci-robot
Copy link
Contributor

@cynepco3hahue: This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 9, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @cynepco3hahue. 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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the needs-priority Indicates a PR lacks a `priority/foo` label and requires one. label Feb 9, 2021
@cynepco3hahue
Copy link
Author

/assign @klueska

@k8s-ci-robot k8s-ci-robot added area/kubelet sig/node Categorizes an issue or PR as relevant to SIG Node. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Feb 9, 2021
@ehashman ehashman added this to Triage in SIG Node PR Triage Feb 9, 2021
@kikisdeliveryservice
Copy link
Member

/ok-to-test
triage/accepted

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 11, 2021
@kikisdeliveryservice kikisdeliveryservice added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Feb 11, 2021
@kikisdeliveryservice kikisdeliveryservice moved this from Triage to Needs Reviewer in SIG Node PR Triage Feb 11, 2021
@kikisdeliveryservice kikisdeliveryservice added the priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. label Feb 11, 2021
@k8s-ci-robot k8s-ci-robot removed the needs-priority Indicates a PR lacks a `priority/foo` label and requires one. label Feb 11, 2021
@cynepco3hahue
Copy link
Author

/retest

@cynepco3hahue cynepco3hahue force-pushed the set_container_memory_during_creation branch from 99ef69f to 92ddcf7 Compare February 15, 2021 14:10
@cynepco3hahue cynepco3hahue force-pushed the set_container_memory_during_creation branch from 92ddcf7 to 92859c1 Compare March 2, 2021 10:51

// GetMemory provides NUMA nodes that used to allocate the container memory
func (m *manager) GetMemoryNUMANodes(pod *v1.Pod, container *v1.Container) string {
Copy link
Contributor

Choose a reason for hiding this comment

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

It feels odd to have this return a string. I think (from an abstraction perspective) it would be better to return an []int and do the conversion to a string at its point of use.

Or better yet, a sets.Int to avoid the need for tmpNodes below.

Copy link
Author

Choose a reason for hiding this comment

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

good point!

Copy link
Author

Choose a reason for hiding this comment

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

done

@@ -82,6 +81,9 @@ type Manager interface {
// and is consulted to achieve NUMA aware resource alignment among this
// and other resource controllers.
GetPodTopologyHints(*v1.Pod) map[string][]topologymanager.TopologyHint

// GetMemory provides NUMA nodes that used to allocate the container memory
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: s/nodes that used/nodes that are used/

Copy link
Author

Choose a reason for hiding this comment

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

done


// GetMemory provides NUMA nodes that used to allocate the container memory
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: s/nodes that used/nodes that are used/

Copy link
Author

Choose a reason for hiding this comment

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

done

@cynepco3hahue cynepco3hahue force-pushed the set_container_memory_during_creation branch from 92859c1 to f1d352a Compare March 2, 2021 14:31
@@ -31,5 +34,16 @@ func (i *internalContainerLifecycleImpl) PreCreateContainer(pod *v1.Pod, contain
}
}

if i.memoryManager != nil {
numaNodes := i.memoryManager.GetMemoryNUMANodes(pod, container)
if len(numaNodes) > 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

It's probably better to use numaNodes.Len() here incase the underlying abstraction ever changes.

Copy link
Author

Choose a reason for hiding this comment

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

done

if len(nodes) < 1 {
klog.V(5).Infof("[memorymanager] update container resources is skipped due to memory blocks are empty")
return nil
if len(numaNodes) < 1 {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would just do == 0 instead of < 1 here.
I would also explicitly return nil, to make it obvious that this is the exceptional case with no elements.

Copy link
Author

Choose a reason for hiding this comment

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

done

Set the container cpuset.memory during the creation and avoid an additional
call to the resources update of the container.

Signed-off-by: Artyom Lukianov <alukiano@redhat.com>
@cynepco3hahue cynepco3hahue force-pushed the set_container_memory_during_creation branch from f1d352a to 95b2777 Compare March 2, 2021 15:02
@klueska
Copy link
Contributor

klueska commented Mar 2, 2021

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cynepco3hahue, klueska

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 Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 2, 2021
@klueska
Copy link
Contributor

klueska commented Mar 2, 2021

Let me know when you get tests passing and I'll back through and do one more pass and add an LGTM

@cynepco3hahue
Copy link
Author

@klueska A lot of thanks, I am waiting for the PR #98572 to be merged.

@cynepco3hahue
Copy link
Author

/retest

@cynepco3hahue
Copy link
Author

/test pull-kubernetes-node-kubelet-serial-memory-manager

2 similar comments
@cynepco3hahue
Copy link
Author

/test pull-kubernetes-node-kubelet-serial-memory-manager

@cynepco3hahue
Copy link
Author

/test pull-kubernetes-node-kubelet-serial-memory-manager

@klueska
Copy link
Contributor

klueska commented Mar 3, 2021

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 3, 2021
@k8s-ci-robot k8s-ci-robot merged commit ad80c76 into kubernetes:master Mar 3, 2021
SIG Node PR Triage automation moved this from Needs Reviewer to Done Mar 3, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.21 milestone Mar 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/kubelet cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. release-note-none Denotes a PR that doesn't merit a release note. sig/node Categorizes an issue or PR as relevant to SIG Node. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants