e6af051c93
A comment in the nomad source code states that swapping for executor_linux allocations is disabled but it wasn't. Nomad wrote -1 to the memsw.limit_in_bytes cgroup file to disable swapping. This has the following problems: 1.) Writing -1 to the file does not disable swapping. It sets the limit for memory and swap to unlimited. 2.) On common Linux distributions like Ubuntu 16.04 LTS the memsw.limit_in_bytes cgroup file does not exist by default. The memsw.limit_in_bytes file only exist if the Linux kernel is build with CONFIG_MEMCG_SWAP=yes and either CONFIG_MEMCG_SWAP_ENABLED=yes or when the kernel parameter swapaccount=1 is passed during boot. Most Linux distributions disable swap accounting by default because of higher memory usage. Nomad silently ignores if writing to the memsw.limit_in_bytes file fails. The allocation succeeds, no message is logged to notify the user. To ensure that disabling swap works on common Linux kernels, disable swapping by writing 0 to the memory.swappiness file. Using the memory.swappiness file only requires that the kernel is compiled with CONFIG_MEMCG=yes. This is the default in common Linux kernels. |
||
---|---|---|
.. | ||
allocdir | ||
config | ||
driver | ||
fingerprint | ||
getter | ||
lib/streamframer | ||
servers | ||
stats | ||
structs | ||
testutil | ||
vaultclient | ||
acl.go | ||
acl_test.go | ||
alloc_endpoint.go | ||
alloc_endpoint_test.go | ||
alloc_runner.go | ||
alloc_runner_health_watcher.go | ||
alloc_runner_test.go | ||
alloc_watcher.go | ||
alloc_watcher_test.go | ||
client.go | ||
client_stats_endpoint.go | ||
client_stats_endpoint_test.go | ||
client_test.go | ||
consul.go | ||
consul_template.go | ||
consul_template_test.go | ||
consul_testing.go | ||
fingerprint_manager.go | ||
fingerprint_manager_test.go | ||
fs_endpoint.go | ||
fs_endpoint_test.go | ||
gc.go | ||
gc_test.go | ||
restarts.go | ||
restarts_test.go | ||
rpc.go | ||
rpc_test.go | ||
state_database.go | ||
task_runner.go | ||
task_runner_test.go | ||
task_runner_unix_test.go | ||
testing.go | ||
util.go | ||
util_test.go |