Skip to content

Commit e0a4dce

Browse files
committed
common/pkg/cgroups/systemd_linux.go: Simplified rewrite
Ref: containers#417 (comment) Signed-off-by: Lokesh Mandvekar <[email protected]>
1 parent 2c9fdbd commit e0a4dce

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

common/pkg/cgroups/systemd_linux.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,10 @@ func resourcesToProps(res *cgroups.Resources) (map[string]uint64, map[string]str
196196
uMap["MemoryMax"] = uint64(res.Memory)
197197
}
198198
if res.MemorySwap != 0 {
199-
switch {
200-
case res.Memory == -1 || res.MemorySwap == -1:
199+
if res.Memory == -1 || res.MemorySwap == -1 {
201200
swap := -1
202201
uMap["MemorySwapMax"] = uint64(swap)
203-
default:
202+
} else {
204203
// swap max = swap (limit + swap limit) - limit
205204
uMap["MemorySwapMax"] = uint64(res.MemorySwap - res.Memory)
206205
}

0 commit comments

Comments
 (0)