-
Notifications
You must be signed in to change notification settings - Fork 950
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
Conversation
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) { |
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.
how about if (memorySwappiness < -1 || memorySwappiness > 100)
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.
Do not do this, [0, 100] is a valid value, -1 is the value we enable to follow with moby.
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.
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) { |
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.
how about if r.MemorySwappiness != nil (*r.MemorySwappiness < -1 || *r.MemorySwappiness > 100)
Codecov Report
@@ 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
|
LGTM |
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