From 03ebe3727891499118dcabbeef8526f799dee966 Mon Sep 17 00:00:00 2001 From: Florian Sesser <florian@private.storage> Date: Tue, 29 Aug 2023 15:34:21 +0000 Subject: [PATCH] We want to swap in emergency situations so we have some time to recover On never kernels, a swappiness of 0 means "disable swap completely" where it would before ~ 2.6.32 would still allow the kernel to swap in certain emergency situations. We have alerting in place in case of any swapping, hoping we can react quickly enough to catch problems of runaway machines before they have to haywire OOM or reboot. Command: `rg -l swappiness | xargs sed -i 's/swappiness" = 0/swappiness" = 1/'` (but not adding the change to the virtual hardware for the local grid). --- morph/grid/production/storage001-hardware.nix | 2 +- morph/grid/production/storage002-hardware.nix | 2 +- morph/grid/production/storage003-hardware.nix | 2 +- morph/grid/production/storage004-hardware.nix | 2 +- morph/grid/production/storage005-hardware.nix | 2 +- morph/lib/issuer-aws.nix | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/morph/grid/production/storage001-hardware.nix b/morph/grid/production/storage001-hardware.nix index b2ca97c1..64f945ed 100644 --- a/morph/grid/production/storage001-hardware.nix +++ b/morph/grid/production/storage001-hardware.nix @@ -12,7 +12,7 @@ boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; - boot.kernel.sysctl = { "vm.swappiness" = 0; }; + boot.kernel.sysctl = { "vm.swappiness" = 1; }; fileSystems."/" = { device = "/dev/disk/by-uuid/f72c1f46-6723-45bf-9ef7-92f31cc37589"; diff --git a/morph/grid/production/storage002-hardware.nix b/morph/grid/production/storage002-hardware.nix index 2f354ad2..69b69460 100644 --- a/morph/grid/production/storage002-hardware.nix +++ b/morph/grid/production/storage002-hardware.nix @@ -12,7 +12,7 @@ boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; - boot.kernel.sysctl = { "vm.swappiness" = 0; }; + boot.kernel.sysctl = { "vm.swappiness" = 1; }; fileSystems."/" = { device = "/dev/disk/by-uuid/0e92ada9-effb-42e2-a26a-9cdb529bcdc7"; diff --git a/morph/grid/production/storage003-hardware.nix b/morph/grid/production/storage003-hardware.nix index d8ffe5d5..f4d68cac 100644 --- a/morph/grid/production/storage003-hardware.nix +++ b/morph/grid/production/storage003-hardware.nix @@ -13,7 +13,7 @@ boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; boot.supportedFilesystems = [ "zfs" ]; - boot.kernel.sysctl = { "vm.swappiness" = 0; }; + boot.kernel.sysctl = { "vm.swappiness" = 1; }; fileSystems."/" = { device = "/dev/disk/by-uuid/240fc1f6-cd55-48a3-ac80-5b3550a32ef5"; diff --git a/morph/grid/production/storage004-hardware.nix b/morph/grid/production/storage004-hardware.nix index 1fe78a76..6cc5ddc3 100644 --- a/morph/grid/production/storage004-hardware.nix +++ b/morph/grid/production/storage004-hardware.nix @@ -12,7 +12,7 @@ boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; - boot.kernel.sysctl = { "vm.swappiness" = 0; }; + boot.kernel.sysctl = { "vm.swappiness" = 1; }; fileSystems."/" = { device = "/dev/disk/by-uuid/d628122e-05d9-4212-b6a5-4b9516d85dbe"; diff --git a/morph/grid/production/storage005-hardware.nix b/morph/grid/production/storage005-hardware.nix index e8f7b639..45f4da4b 100644 --- a/morph/grid/production/storage005-hardware.nix +++ b/morph/grid/production/storage005-hardware.nix @@ -12,7 +12,7 @@ boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; - boot.kernel.sysctl = { "vm.swappiness" = 0; }; + boot.kernel.sysctl = { "vm.swappiness" = 1; }; fileSystems."/" = { device = "/dev/disk/by-uuid/2653c6bb-396f-4911-b9ff-b68de8f9715d"; diff --git a/morph/lib/issuer-aws.nix b/morph/lib/issuer-aws.nix index 8a7c14ec..7455a437 100644 --- a/morph/lib/issuer-aws.nix +++ b/morph/lib/issuer-aws.nix @@ -6,7 +6,7 @@ boot.loader.grub.device = lib.mkForce "/dev/nvme0n1"; ec2.hvm = true; - boot.kernel.sysctl = { "vm.swappiness" = 0; }; + boot.kernel.sysctl = { "vm.swappiness" = 1; }; swapDevices = [ { device = "/var/swapfile"; size = 4096; # megabytes -- GitLab