Merge pull request #86 from ktraghavendra/85_container_swappiness

Treat -1 as default value for memory swappiness
This commit is contained in:
Mrunal Patel 2015-07-06 10:12:22 -07:00
commit 5ec11a2918
2 changed files with 8 additions and 0 deletions

View File

@ -75,6 +75,10 @@ func (s *MemoryGroup) Set(path string, cgroup *configs.Cgroup) error {
if err := writeFile(path, "memory.swappiness", strconv.FormatInt(cgroup.MemorySwappiness, 10)); err != nil {
return err
}
} else if cgroup.MemorySwappiness == -1 {
return nil
} else {
return fmt.Errorf("invalid value:%d. valid memory swappiness range is 0-100", cgroup.MemorySwappiness)
}
return nil

View File

@ -511,6 +511,10 @@ func joinMemory(c *configs.Cgroup, pid int) error {
if err != nil {
return err
}
} else if c.MemorySwappiness == -1 {
return nil
} else {
return fmt.Errorf("invalid value:%d. valid memory swappiness range is 0-100", c.MemorySwappiness)
}
return nil