summary refs log tree commit diff stats
path: root/system/settings
diff options
context:
space:
mode:
authorAlan Pearce2021-01-12 17:02:27 +0100
committerAlan Pearce2021-01-12 17:02:27 +0100
commit0ec55c7bd5465d93ed406aef3bf6c1d0bdb5e003 (patch)
tree543d596a39438251c3a0f39459e7da1b1f6d1ab6 /system/settings
parent82eac6549fe01ecd4b8aec799f1dba37eb253ecd (diff)
downloadnixfiles-0ec55c7bd5465d93ed406aef3bf6c1d0bdb5e003.tar.lz
nixfiles-0ec55c7bd5465d93ed406aef3bf6c1d0bdb5e003.tar.zst
nixfiles-0ec55c7bd5465d93ed406aef3bf6c1d0bdb5e003.zip
bare-metal: set optimal IO scheduler per disk type
Diffstat (limited to 'system/settings')
-rw-r--r--system/settings/hardware/bare-metal.nix9
1 files changed, 9 insertions, 0 deletions
diff --git a/system/settings/hardware/bare-metal.nix b/system/settings/hardware/bare-metal.nix
index 998001c0..130c2d21 100644
--- a/system/settings/hardware/bare-metal.nix
+++ b/system/settings/hardware/bare-metal.nix
@@ -9,6 +9,15 @@
     usbutils
   ];
 
+  services.udev.extraRules = ''
+    # set scheduler for NVMe
+    ACTION=="add|change", KERNEL=="nvme[0-9]n[0-9]", ATTR{queue/scheduler}="none"
+    # set scheduler for SSD and eMMC
+    ACTION=="add|change", KERNEL=="sd[a-z]|mmcblk[0-9]*", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="mq-deadline"
+    # set scheduler for rotating disks
+    ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="1", ATTR{queue/scheduler}="bfq"
+  '';
+
   boot.kernel.sysctl = {
     "net.ipv4.tcp_allowed_congestion_control" = "illinois reno lp";
     "net.ipv4.tcp_congestion_control" = "illinois";