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

client: do not disable memory swappiness if kernel does not support it #17625

Merged
merged 3 commits into from
Jun 22, 2023

Conversation

shoenig
Copy link
Member

@shoenig shoenig commented Jun 20, 2023

This PR adds a workaround for very old Linux kernels which do not support
the memory swappiness interface file. Normally we write a "0" to the file
to explicitly disable swap. In the case the kernel does not support it,
give libcontainer a nil value so it does not write anything.

Fixes #17448

This PR adds a workaround for very old Linux kernels which do not support
the memory swappiness interface file. Normally we write a "0" to the file
to explicitly disable swap. In the case the kernel does not support it,
give libcontainer a nil value so it does not write anything.

Fixes #17448
@shoenig shoenig added this to the 1.6.0 milestone Jun 21, 2023
@shoenig shoenig added backport/1.3.x backport to 1.3.x release line backport/1.4.x backport to 1.4.x release line backport/1.5.x backport to 1.5.x release line labels Jun 21, 2023
@shoenig
Copy link
Member Author

shoenig commented Jun 22, 2023

Spot check we on 20.04 (cgroups v1) that we didn't break anything

ubuntu@ip-172-31-4-13:~$ sudo ./nomad/bin/nomad version
Nomad v1.6.0-dev
BuildDate 2023-06-21T13:20:42Z
Revision 76e419aec82ae7a2e8c909adbff3c299bab3252a+CHANGES

checking our agent detects cgroups v1

ubuntu@ip-172-31-4-13:~$ ./nomad/bin/nomad node status -self -verbose | grep cgroup
unique.cgroup.mountpoint                 = /sys/fs/cgroup/systemd
unique.cgroup.version                    = v1

swappiness is still set on cgroups v1 on newer kernels

ubuntu@ip-172-31-4-13:~/nomad/client/lib/cgutil$ sudo /usr/local/go/bin/go test -v -run TestUtil_MaybeDisableMemorySwappiness
=== RUN   TestUtil_MaybeDisableMemorySwappiness
=== PAUSE TestUtil_MaybeDisableMemorySwappiness
=== CONT  TestUtil_MaybeDisableMemorySwappiness
--- PASS: TestUtil_MaybeDisableMemorySwappiness (0.00s)
PASS
ok      github.com/hashicorp/nomad/client/lib/cgutil    0.019s

running exec tests

ubuntu@ip-172-31-4-13:~/nomad/drivers/exec$ sudo /usr/local/go/bin/go test 1>/dev/null 2>&1
ubuntu@ip-172-31-4-13:~/nomad/drivers/exec$ echo $?
0

@shoenig shoenig marked this pull request as ready for review June 22, 2023 13:23
Copy link
Member

@jrasell jrasell left a comment

Choose a reason for hiding this comment

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

LGTM.

.changelog/17625.txt Outdated Show resolved Hide resolved
Co-authored-by: James Rasell <jrasell@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/1.3.x backport to 1.3.x release line backport/1.4.x backport to 1.4.x release line backport/1.5.x backport to 1.5.x release line
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nomad client fails to start a job
3 participants