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

Hugetlbfs support based on empty dir volume plugin #50072

Merged

Conversation

squall0gd
Copy link

@squall0gd squall0gd commented Aug 3, 2017

What this PR does / why we need it: Support for huge pages in empty dir volume plugin. More information about hugepages can be found here

Feature track issue: kubernetes/enhancements#275

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes #

Special notes for your reviewer:

Release note:

Support for Huge pages in empty_dir volume plugin
[Huge pages](https://www.kernel.org/doc/Documentation/vm/hugetlbpage.txt) can now be used with empty dir volume plugin.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 3, 2017
@k8s-ci-robot
Copy link
Contributor

Hi @squall0gd. 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.

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. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Aug 3, 2017
@k8s-github-robot k8s-github-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Aug 3, 2017
@squall0gd squall0gd force-pushed the squall0gd/hugepages_support branch from cbd37ac to 9f2fcf8 Compare August 3, 2017 08:25
@k8s-github-robot k8s-github-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Aug 3, 2017
@@ -699,6 +699,8 @@ type EmptyDirVolumeSource struct {
// More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir
// +optional
Medium StorageMedium `json:"medium,omitempty" protobuf:"bytes,1,opt,name=medium,casttype=StorageMedium"`
// +optional
HugetlbfsSize string `json:"hugetlbfsSize,omitempty" protobuf:"bytes,3,opt,name=hugetlbfsSize"`
Copy link
Member

Choose a reason for hiding this comment

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

Since HugetlbfsSize is new-added. You'd need to run auto-gen scripts again (make update will run all auto-gen scripts).

Copy link
Author

Choose a reason for hiding this comment

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

👍

if isMnt && medium == mediumHugepages {
return nil
}
if ed.size == "" {
Copy link
Member

Choose a reason for hiding this comment

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

Does this mean that if we are using StorageMediumHugetlbfs, the size is also needed alongside?

If so, you'd better add some validations in pkg/api/validation/validation.go.

Copy link
Author

Choose a reason for hiding this comment

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

It's required in that case. I will move this validation to pkg/api/validation/validation.go

pkg/api/types.go Outdated
@@ -614,6 +614,8 @@ type EmptyDirVolumeSource struct {
// The default is "" which means to use the node's default medium.
// +optional
Medium StorageMedium
// +optional
HugetlbfsSize string
Copy link
Member

Choose a reason for hiding this comment

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

It's kind of confusing to declare xxSize as string. May it be int?

Copy link
Author

Choose a reason for hiding this comment

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

I'll use Quantity here :)

Copy link
Member

Choose a reason for hiding this comment

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

+1 to quantity

@@ -172,6 +179,7 @@ type emptyDir struct {
mounter mount.Interface
mountDetector mountDetector
plugin *emptyDirPlugin
size string
Copy link
Member

@dixudx dixudx Aug 3, 2017

Choose a reason for hiding this comment

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

Maybe int?

Copy link
Author

Choose a reason for hiding this comment

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

I think it's better to use Quantity here b/c I need to keep unit.

@xiangpengzhao
Copy link
Contributor

@squall0gd FYI, there is a proposal on HugePages here: kubernetes/community#837

/cc @derekwaynecarr

@k8s-github-robot k8s-github-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 3, 2017
@derekwaynecarr
Copy link
Member

i want to make sure we have agreement on the proposal referenced before merging this, but thank you for your help!

@derekwaynecarr derekwaynecarr added this to the v1.8 milestone Aug 9, 2017
@derekwaynecarr
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Aug 9, 2017
@derekwaynecarr derekwaynecarr self-assigned this Aug 9, 2017
pkg/api/types.go Outdated
StorageMediumMemory StorageMedium = "Memory" // use memory (tmpfs)
StorageMediumDefault StorageMedium = "" // use whatever the default is for the node
StorageMediumMemory StorageMedium = "Memory" // use memory (tmpfs)
StorageMediumHugetlbfs StorageMedium = "Hugetlbfs" // use hugepages
Copy link
Member

Choose a reason for hiding this comment

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

prefer HugePages

}

glog.V(3).Infof("pod %v: mounting hugepages for volume %v", ed.pod.UID, ed.volName)
mountOptions := []string{fmt.Sprintf("size=%s", ed.size)}
Copy link
Member

Choose a reason for hiding this comment

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

i don't understand why you have size.

size is bounded by sum resource requirement across containers on pod.

we need a new field specific for hugepages that aligns with pagesize. mount option.

Copy link
Author

Choose a reason for hiding this comment

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

well I've used size w/o any reason - just want some, easy to track parameter, to verify that passing mount options is working correctly. Actually I'm waiting for proposal's merge to finalize implementing mount options and to play with unit tests. :)

@squall0gd squall0gd force-pushed the squall0gd/hugepages_support branch from 7148723 to 3c0861b Compare August 16, 2017 10:09
@k8s-github-robot k8s-github-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Aug 16, 2017
@derekwaynecarr
Copy link
Member

/lgtm

Thanks @squall0gd for your help getting this support.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 1, 2017
@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to @fejta).

Review the full test history for this PR.

@PiotrProkop
Copy link
Contributor

/test pull-kubernetes-e2e-kops-aws

@squall0gd
Copy link
Author

/retest

1 similar comment
@squall0gd
Copy link
Author

/retest

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to @fejta).

Review the full test history for this PR.

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 3, 2017
@squall0gd squall0gd force-pushed the squall0gd/hugepages_support branch from 073ac49 to 59a86e4 Compare September 5, 2017 15:20
@k8s-github-robot k8s-github-robot removed lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Sep 5, 2017
@eparis
Copy link
Contributor

eparis commented Sep 5, 2017

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 5, 2017
@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: childsb, derekwaynecarr, eparis, smarterclayton, squall0gd

Associated issue: 275

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@squall0gd
Copy link
Author

/retest

@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Sep 5, 2017

@squall0gd: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-cross 59a86e4 link /test pull-kubernetes-cross
pull-kubernetes-e2e-kops-aws 59a86e4 link /test pull-kubernetes-e2e-kops-aws

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@jdumars
Copy link
Member

jdumars commented Sep 5, 2017

Curious how this got merged despite failing cross:
I0905 18:14:23.457] pkg/volume/empty_dir/empty_dir_linux.go:54: constant 2508478710 overflows int32
@squall0gd did this error always present in testing and it just got missed?

@squall0gd
Copy link
Author

@jdumars didn't notice this error before. Just some timeouts on e2e gates

@jdumars
Copy link
Member

jdumars commented Sep 5, 2017

The test will need to be updated in order to accommodate the change.

@squall0gd
Copy link
Author

@jdumars Well it looks like we need to add type to magic number constant. Sadly we need to do this in another PR.

@liggitt
Copy link
Member

liggitt commented Sep 5, 2017

opened #51984 to type-cast the comparison to the constant

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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.