Skip to content

Commit

Permalink
backport of commit 76e419a
Browse files Browse the repository at this point in the history
  • Loading branch information
shoenig committed Jun 21, 2023
1 parent c18f381 commit fd8eb68
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions client/lib/cgutil/cgutil_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,11 @@ func MaybeDisableMemorySwappiness() *uint64 {
return zero
}

// cgroups v1 check if the root and swappiness interface exist
_, err := os.Stat("/sys/fs/cgroup/memory/memory.swappiness")
if os.IsNotExist(err) {
// cgroups v1 detect if swappiness is supported by attempting to write to
// the nomad parent cgroup swappiness interface
e := &editor{fromRoot: "memory/nomad"}
err := e.write("memory.swappiness", "0")
if err != nil {
return bypass
}

Expand Down

0 comments on commit fd8eb68

Please sign in to comment.