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

cgroup: enable memory swappiness equal to -1 #2092

Merged
merged 1 commit into from
Aug 14, 2018
Merged

cgroup: enable memory swappiness equal to -1 #2092

merged 1 commit into from
Aug 14, 2018

Conversation

Ace-Tang
Copy link
Contributor

@Ace-Tang Ace-Tang commented Aug 14, 2018

Signed-off-by: Ace-Tang aceapril@126.com

Ⅰ. Describe what this PR did

enable memory-swappiness can be set to -1, -1 means do nothing.

Ⅱ. Does this pull request fix one issue?

Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)

add!

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

Signed-off-by: Ace-Tang <aceapril@126.com>
@@ -6,7 +6,7 @@ import "fmt"

// ValidateMemorySwappiness verifies the correctness of memory-swappiness.
func ValidateMemorySwappiness(memorySwappiness int64) error {
if memorySwappiness < 0 || memorySwappiness > 100 {
if memorySwappiness != -1 && (memorySwappiness < 0 || memorySwappiness > 100) {
Copy link
Contributor

Choose a reason for hiding this comment

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

how about if (memorySwappiness < -1 || memorySwappiness > 100)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do not do this, [0, 100] is a valid value, -1 is the value we enable to follow with moby.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, You are the boss :)

@@ -100,7 +100,7 @@ func validateResource(r *types.Resources, update bool) ([]string, error) {
warnings = append(warnings, MemorySwappinessWarn)
r.MemorySwappiness = nil
}
if r.MemorySwappiness != nil && (*r.MemorySwappiness < 0 || *r.MemorySwappiness > 100) {
if r.MemorySwappiness != nil && *r.MemorySwappiness != -1 && (*r.MemorySwappiness < 0 || *r.MemorySwappiness > 100) {
Copy link
Contributor

Choose a reason for hiding this comment

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

how about if r.MemorySwappiness != nil (*r.MemorySwappiness < -1 || *r.MemorySwappiness > 100)

@codecov-io
Copy link

Codecov Report

Merging #2092 into master will decrease coverage by 0.03%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2092      +/-   ##
==========================================
- Coverage   65.02%   64.98%   -0.04%     
==========================================
  Files         209      209              
  Lines       16227    16227              
==========================================
- Hits        10551    10545       -6     
- Misses       4368     4372       +4     
- Partials     1308     1310       +2
Flag Coverage Δ
#criv1alpha1test 33.38% <0%> (+0.09%) ⬆️
#criv1alpha2test 33.92% <0%> (-0.11%) ⬇️
#integrationtest 39.94% <33.33%> (-0.02%) ⬇️
#unittest 23.81% <33.33%> (ø) ⬆️
Impacted Files Coverage Δ
daemon/mgr/container_validation.go 45.09% <0%> (ø) ⬆️
daemon/mgr/spec_linux.go 74.47% <100%> (ø) ⬆️
apis/opts/memory_swappiness.go 100% <100%> (ø) ⬆️
cri/stream/httpstream/spdy/upgrade.go 54.28% <0%> (-5.72%) ⬇️
apis/server/utils.go 61.9% <0%> (-4.77%) ⬇️
ctrd/watch.go 72.72% <0%> (-3.04%) ⬇️
cri/v1alpha2/cri.go 64.89% <0%> (-0.18%) ⬇️
cri/v1alpha1/cri.go 64.22% <0%> (+0.17%) ⬆️

@HusterWan
Copy link
Contributor

LGTM

@pouchrobot pouchrobot added the LGTM one maintainer or community participant agrees to merge the pull reuqest. label Aug 14, 2018
@HusterWan HusterWan merged commit 6fd49d0 into AliyunContainerService:master Aug 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LGTM one maintainer or community participant agrees to merge the pull reuqest. size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants